IoT - Gadgeteer - Getting started

In this blog series I want to show you how to get started with the Microsoft .NET Gadgeteer module.
I’ll take you through all the steps required to start you own Internet of Things (IoT) project. In this first blog we’ll set up the environment and create our first application.

Setting up the environment

Make sure you have Visual Studio 2012 or up, but only till Visual Studio 2013 because the newest generation is, while writing this, not yet supported.

Download and install NETMF:
Download and install .NET Gadgeteer Core:
Download and install SDK NETMF and Gadgeteer Package:

After everything is installed launch the Visual Studio environment.

  • Select ‘New Project’ and expand the ‘Templates’ tree.
  • Select ‘Visual C#’ followed by ‘Gadgeteer’.
  • Select ‘.NET Gadgeteer Application’ type in a name select a location to save the solution.
  • Finally press ‘OK’ to finish the creation of the solution.

Creating a Gadgeteer project (click on the image to enlarge)

After you click ‘OK’ you will get the option to select the main-board you are using.
Select the correct main-board before you continue.

Make sure you select the latest .NET Micro Framework after you’ve selected your mainboard.

Select the correct board and Framework version (click on the image to enlarge)

When you’ve selected the main-board and correct .NET Micro FrameWork press ‘Create’.
Visual Studio will now start creating your Gadgeteer solution

Connecting the Modules

The solution starts with the Designer screen where you see your mainboard.
From the Toolbox you can simply select and pull the modules you have onto the designer board.

We need to connect and power the board using a USB cable or external power supply.
For this project I’m using the ‘USB Client DP’ (where DP stands for dual power, but I only use the USB cable for now)
Scroll down in the Toolbox and select the appropriate power module.
Now Hold the left mouse button and drag the module onto the designer.
Select the power module from the Toolbox (click on the image to enlarge)

Now we have to connect the module to the main-board. We can do this fairly easy by right clicking somewhere in the designer. A context menu appears and you will be able to select the ‘Connect all modules’
Select the power module from the Toolbox (click on the image to enlarge)

The power module was automatically attached to the empty slot #2 which has the letter ‘D’ assigned to it.

A side note
You can also attach the modules manually by matching the letter(s) on the modules port with a port on the main-board with the same letter. So in this case the USB Client DP module has the letter ‘D’ next to its port. You can find a free port on the main-board which also has the letter ‘D’ next to it. After you’ve connected the module you have to drag a line between the module port and the main-board port.
This can also be done by clicking and holding the port in the designer view and dragging the line up to the matching port on the main-board (and vice versa)

Press ‘Save all’ (CTRL+SHIFT+S) to save the solution and the created bindings.

And now.. the programming part.

Switch to the ‘Program.cs’ file.
We have to make sure that we do not block the main thread on the Gadgeteer module otherwise your whole application will hang
So let’s start of with creating a using reference to the Gadgeteer.Timer like so:

using Timer = Gadgeteer.Timer;

In the Program class we create a private readonly Timer called ‘_mainTimer’ which we create directly with an interval of 500 milliseconds:

private readonly Timer _mainTimer = new Timer(500);

In the ‘ProgramStarted()’ function we set an EventHandler on the _mainTimer.Tick event:

_mainTimer.Tick+= OnMainTimerTick;

We can do this by typing: ‘_mainTimer.Tick +=’ and then press the ‘Tab’ button twice.
Your code should look similar to this:
Code example 001 (click on the image to enlarge)

After we’ve assigned the event handler we need to make sure the timer actually starts.
So we call the Start() function on the Timer object.


Finally we want to light up the Debug LED on the mainboard on every tick of the timer.
So in the OnMainTimerTick() function we can write the following code:


So your ‘final’ code should look like this:

using Microsoft.SPOT;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Timer = Gadgeteer.Timer;
namespace GadgeteerThermostat
public partial class Program
private readonly Timer _mainTimer = new Timer(500);
// This method is run when the mainboard is powered up or reset.
private void ProgramStarted()

Debug.Print("Program Started");
_mainTimer.Tick += OnMainTimerTick;
private void OnMainTimerTick(Timer timer)


Now attach the device via USB to the computer and press ‘Play’ (or hit ‘F5’).

And there you have it.. Your first Gadgeteer project..*
..being a very expensive blinking LED. :)