Hydra 'hello world'?

Just looking for making the led flash. All the docs and samples Ive seen apply to other boards, and hydra isn’t listed as a template in visual studio 2010 after installing the software. Searching ‘hydra’ on the Code page here on TinyCLR turns up zero hits, too, maybe because hydra is new or (more likely) Im just klueless… ::slight_smile:

First, make sure you’ve downloaded the latest SDK and have installed the latest firmware.

Hydra is a Gadgeteer board. Start with this:

Create a new project using the “.NET Gadgeteer Application” template.

Have fun and welcome to the community!

Hydra is a gadgeteer board. That is the template you need.

See free books under downloads please.

If I had not already been through all of those steps, I would not have posted the question. Its after doing all of that, and searching this entire forum, its associated code repositories, and the Internet itself, and still failing to flash the hydra’s green onboard led that I post.

I never encountered the term ‘gadgeteer’ until I received this board last night, and Im not impressed. I don’t own any other board type, and I have never written a .NET micro framework program, but I could cough up several code samples to flash the onboard leds of several board types, from GHI and others.

That apparently nobody can do that with the hydra tells me this is the wrong board type for me.

I will shop around for a non-‘gadgeteer’ system.

Startlight, don’t be so quick to give up. Gadgeteer is by far the easiest board type out there. Did you see chapter 11 of the eBook titled “Blink an LED”? There are five pages dedicated to exactly what you’re asking for. If you’re having a problem, please post more details about it.

Did you see the free gadgeteer ebook on this page?

If you are not impressed with hydra then you still do not know what it can do for you :slight_smile:

Yes, of course I saw that in chapter 11.
But that blinks an LED module, not the onboard green LED.

My objective was to toggle pin PD18 on the schematic (sheet 1) to flash the green onboard LED, for the larger goal of demonstrating pin-level control of the hydra SBC from within .NETMF.

The hydra with its gadgeteer layer seems unable to do this, as the gadgeteer layer gets in the way.
Gadgeteer seems all about finished hardware peripherals such as LED modules and their associated
finished software object representations.

The code samples for the other GHI products and other vendors such as netduino show how easy it is to have complete low-level control over such things.

For example, the GHI ‘Cobra’ (from the sample):

(reference: FEZCobra_GHIElectronics.NETMF.FEZ)
using GHIElectronics.NETMF.FEZ;

OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);

Apparently such control is absent from the hydra, so these other boards may be a better fit for me.


You can use the sample code that you just mentioned on the Hydra. You do not necessarily need to make a Gadgeteer project on a Gadgeteer board. You can still make a regular console application.

Here is the code as a regular console application that gives you the level of control that you are trying to use:

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace HydraBlinkOnBoardGreenLED
    public class Program
        public static void Main()
            OutputPort LED = new OutputPort((Cpu.Pin)((32 * 3) + 18), true);

            while (true)


Try this code and it should work for you.

This is gadgeteer mainboard so it is easier to use the board with the gadgeteer services. You can do what Aron suggested but you can also do this easier by

Cpu.Pin P3 = GT.Socket.GetSocket(9, false, null, null).CpuPins[3]; // socket 9 pin 3

Use the code above and you do not even need to look at the schematics.

I was a little delayed executing this approach due to deploy errors in Visual Studio 2010,
which ‘MFDeploy’ diagnosed as a ‘ping’ failure. It turns out if I hold the board I can deploy, otherwise I cannot. I will try moving cables and USB ports.

The code here works, after I get it to deploy.
These are good approaches as now I can refer to either hardware view, socket or schematic.

I believe I will pick up a Cobra board anyway just to check it out.

Thanks very much for that code. It was exactly what I needed.

Here is an even more simple example that will let you turn the onboard led on.

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace GadgeteerApp1
    public partial class Program
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
            // Super simple example to turn the onboard LED on and off

            // Light on

            // Light Off

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

Hope this will help you out.

Thanks, its another option on that board and gadgeteer in general to do such things.

I will get more into gadgeteer but my hydra wont cooperate unless I hold the 'ARM’
chip down with my thumb sometimes. I don’t believe these things come with any warranty so I’ll get another one when they are in stock.

I picked up the chipworkx system for now, later I’ll get that Cobra for A2D since that
capability will be needed. But that hydra is seriously powerful, and I will try these programming techniques here to see if I can accomplish things on the hydra when I get it in, so maybe won’t need Cobra.

Gadgeteer is conceptually pretty cool, for stable hardware, something my project hardware isn’t for now.

update: these things are covered for 6 months. On top of that, manufacturing defects are covered even on modified boards. wow.

Starlight, the more you hang out here the sooner you’ll come to realize that GHI’s support is second to none.

Maybe there could be a more official publication of the start code that is shipped with the Hydra?

I know I shouldn’t have connected a bespoke 7" LCD as my only module, however a simple sanity check like this is nice…

Did you post to the right thread? I’m a little lost at where you’re coming from.

How about a section of the NETMF tutorial with simple sanity checks, like this flashing LED code, for every type of hardware, from Panda to Hydra…

OutputPort LED = new OutputPort((Cpu.Pin)((32 * 3) + 18), true)

That’s cute, but really ((32*3)+18)?!

Have you taken a look at the Getting Started Guides that are installed with the SDK? It seems like this is what you are looking for. There is one available for both the FEZSpider and FEZHydra. They are located in “Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Getting Started Guides”

I think you are missing few points. There is Gadgeteer and there is non-gadgeteer. On gadgeteer, you are expected to use the core to use the pins through the gadgeteer core. That is something like. getpin(socketnum).[pinumber]…I do not recall the exact function.
On non-gadgeteer, there is a DLL with pin names. Using raw numbers is good way of keeping the code generic but this is now how you would program your application normally.

Welcome to the community.