Blogs

.NET Gadgeteer First Round Examples and Thoughts

15 Aug

A few weeks ago I gave a presentation at the St. Louis Day of .NET event focused on the use of .NET Gadgeteer.  In this blog posting I am going to share some of the information from that presentation, as well as the slide deck and sample code for everything discussed.  For those that were in attendance, I apologize for the delay in getting this information out here!

What is .NET Gadgeteer and/or the .NET Micro Framework

When I first start talking about this project and the hardware that I used to make everything work there are a lot of first round questions.  To put it simply we have two parts that come into play with the above listed technologies.  First we have the .NET Micro Framework, which to put it simply is a version of the .NET Framework that is designed to run on devices with limited resources, such as single board micro controllers.  .NET Gadgeteer is then an additional initiative to make the process of developing for these devices easier.  For example, gadgeteer devices such as the FEZ Spider which was used in my demonstrations have design-time support for the layout of the connections as well as they use cables/sockets rather than requiring soldering.  This makes for a smaller barrier to entry.

First Impressions of Gadgeteer?

I have to say from the first project I started until now I am still 100% impressed with the way that the Gadgeteer system works.  It is simple, easy to use, and has a plethora of connections and additional modules to create/control things in any manner that you can use.  For my initial dabbling I focused on simple arcade games and controlling a Rover 5 Tank Chassis using bluetooth. I selected these projects for two reasons.  First of all they were interesting to me, which helped to keep me motivated on pursuing the final solution, and secondly they were items that seem to really be popular and grab the attention of others as well.

In the following sections I'll discuss both projects, at the bottom of this posting you can download all of the referenced code and the presentation materials as well.

Arcade Cabinet Project

This portion of the project was fueled by finding a simple Laser Cut arcade cabinet template that I could use to create a nice, playable, unit for the end result.  I started out writing my own sample game so that I could start to get a feel for the process, then started looking around for other implementations.

My Game

The game that I created is VERY rudimentary in implementation, but was done in less than two hours and only took a little bit of tweaking to get decent play.  The premise is simple, there are objects falling in a random pattern you need to catch them before they fall off of the screen.  The following video shows the game in action.

Simple implementation with two timers and the use of rectangles for drawing.

Other Games

As I was looking for other reference implementations, I stumbled across a Pac Man clone on CodePlex.  Simply downloading it and pushing it to my Spider I had the following.

From here I started looking for other games and came across a simple Snake Game as well, which I've included in the downloads in this post.  Really when it comes down to it, like anything else there are multiple ways of accomplishing the same goal and these three applications are a prime example of that difference.

The Cabinet

For those looking to create their own arcade cabinet, you can get the design and fully cut pieces from Ponoko via this link.

Rover 5 Project

The Rover 5 project was much more involved and did not go nearly as smoothly as the other projects.  The final result was good:

Fully controlled from a WPF application, using a base set of code from Marco Minerva, but that code just would not work no matter what I tried.  I loved the implementation of the WPF application that he used so I started to look at what needed to change with the rover to get things working.

In the end, I found a little known "limitation" with the bluetooth module that it must be fully "ready" before it is put into paring mode.  What this means is that I had to add a 12 second delay.  11 seconds wasn't long enough.  I decided to handle this in the code with a timer, but any other process could be used as well, including requiring the user to press a button to initiate the communication channel.  With less than 500 lines of code required on either side of the process it was really amazing to get the device moving, now with that working it is time to add to it!

Downloads

As I mentioned all of the materials from my presentation can be downloaded for personal use.  Please note that individual copyrights on some of the included files are noted within the projects as they were the foundation for the examples.

Conclusion

I have been having a lot of fun with the Gadgeteer implementation and will be working to blog more here about in-depth code for some of my next ventures, including the ability to take data and post to a remote server.  Feel free to share your comments and/or requests below.

tags: Presentations
comments powered by Disqus

Content provided in this blog is provided "AS-IS" and the information should be used at your own discretion.  The thoughts and opinions expressed are the personal thoughts of Mitchel Sellers and do not reflect the opinions of his employer.

Connect with Mitchel

I hope the information here has been helpful. To stay connected you can also subscribe to blog updates via email, contact Mitchel about consulting services, or reach out for assistance via CodeMendor

Content Copyright

Content in this blog is copyright protected.  Re-publishing on other websites is allowed as long as proper credit and backlink to the article is provided.  Any other re-publishing or distribution of this content is prohibited without written permission from Mitchel Sellers.