Some time ago, I posted an unboxing video for something new, my FEZ Spider .NET Gadgeteer starter kit. Since then, I’ve been busy with both my day job, and spending a lot of my “free” time playing with my Gadgeteer stuff, learning about breadboarding, and generally diving head-first into the world of electronics hardware and microcontrollers.
At first, working in this world was quite intimidating, and I felt almost completely lost. I plugged my first board into my computer with the LCD screen hooked up, and all it showed was some debug information. OK. Where do I go from here, I asked myself?
To help other folks who might be in the same boat (whether you’re a software geek just jumping into Gadgeteer, or someone experienced with other electronics work, but not familiar with Gadgeteer), I’m going to start posting some blog/video posts walking you through the basics of working with .NET Gadgeteer. Some of this information (such as breadboarding, for example, which I’ll cover in a future post) may be applicable to other microcontroller environments, while some will be Gadgeteer-specific.
In this post, I’m going to take you from receiving a .NET Gadgeteer mainboard to the “Hello, World” of embedded electronics, which is flashing an LED.
A side note on the videos…I’m trying an experiment here and recording and posting these videos quickly, with little or no processing or editing, in hopes that keeping the process lightweight will help me get more videos out more quickly. Set your expectations on the video quality appropriately.
I Just Got My FEZ Spider Starter Kit (or similar Gadgeteer-compatible mainboard)…Now What?
If, like me, you go the starter kit route, you’ve spent a little more money, but you now have a mainboard, and a bunch of modules, most of which you probably have no idea what they do, or what to do with them. DON’T PANIC! We’ll start slow with the first video.
Since I already have the necessary software (Visual Studio, .NET Micro Framework, Drivers, etc.) on my machine, I’m not going to show installing those as part of the video. If you’re working with GHI gear, you want to head over to:
and download and install the items under “System Preparation” before going further. This will give you the tools and SDKs you need to get started. It may even open the local version of the Getting Started guide, but don’t leap into that project just yet…watch this first:
That was pretty simple, and required very few lines of code. Adding a display is easy, too. We can modify the original project to also write a message out to a Seeed Studio OLED Display module with just a single line of code, thanks to the SimpleGraphics API (Mike Dodaro has a neat demo of SimpleGraphics with the GHI LCD Display module here). Here’s a video of this in action:
Here’s my design view for the final project:
Here’s the code from the final version of Program.cs:
1: using System;
2: using System.Threading;
3: using Microsoft.SPOT;
4: using Microsoft.SPOT.Presentation;
5: using Microsoft.SPOT.Presentation.Controls;
6: using Microsoft.SPOT.Presentation.Media;
7: using Microsoft.SPOT.Touch;
9: using Gadgeteer.Networking;
10: using GT = Gadgeteer;
11: using GTM = Gadgeteer.Modules;
12: using Gadgeteer.Modules.GHIElectronics;
13: using Gadgeteer.Modules.Seeed;
15: namespace HelloGadgeteer
17: public partial class Program
19: bool IsLedOn = false;
21: // This method is run when the mainboard is powered up or reset.
22: void ProgramStarted()
24: // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
25: Debug.Print("Program Started");
27: GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
28: timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
31: oledDisplay.SimpleGraphics.DisplayTextInRectangle("Hello, Gadgeteer!", 2, 2, 100, 30,
32: GT.Color.Red, Resources.GetFont(Resources.FontResources.NinaB));
34: Debug.Print("Timer Started");
37: void timer_Tick(GT.Timer timer)
40: IsLedOn = !IsLedOn;
Hope you enjoyed this quick stroll through Hello World for Gadgeteer. In my next post, I’ll explore some of the many neat things you can do with .NET Gadgeteer, and the many modules that are already available (with more on the way!).
Another nice thing about Gadgeteer is that there’s a thriving community of Gadgeteer enthusiasts (myself included) that hang out over on the TinyCLR.com Gadgeteer forum. If you have questions, stop by and ask, or just say hello!