Saturday, September 17, 2011

Using a Joystick With NETMF and the NETMFx Joystick Library

As I’m working on the Omnimote, I decided the next article in the NETMF for Electronics Noobs series should be about how to interface a joystick with a NETMF device.
For this example, I’m using a Parallax joystick from Adafruit.comSparkfun has a similar joystick which should work using the same directions although the labels for the pinouts are slightly different.  I prefer the one from Adafruit because it has a nice rubber feel to it and it’s pin headers fit in a breadboard.  The one from SparkFun is a slippery hard plastic and requires you to buy a separate PCB in order to make it breadboard friendly.  It does have the advantage of an additional push button selector built-in that the one from Adafruit does not.  They both have convex tops.  I would have much rather had concave tops such as you get with an XBox 360 controller but these were not carried.

A joystick controller is simply a stick connected to two small potentiometers – one for the left-right (X) motion and one for the up-down (Y) motion.  To connect the joystick to the board, we will need two analog pins plus +5V and ground connections.  The following table will show the labels and pins for these two joysticks.
Adafruit Joystick Sparkfun Joystick Arduino Compatible Pin
L/R+ VCC +5V
L/R HOR Analog*
U/D+ VCC +5V
U/D VER Analog*
Any two analog pins can be used for L/R and U/D.  For this tutorial, I am using Analog0 for L/R and Analog1 for U/D.

This post also serves as an announcement of a new open source NETMF library I’ve created called NETMFx.  This will serve as a place for me (and anyone else who wants to contribute) to put custom drivers and anything NETMF related.  My goal is to make anything in it compatible with both GHI and netduino so that the greater NETMF community can make use of it.  I’ve done this by using conditional compile symbols when necessary.  Be sure and check out the progress made so far in NETMFx.Joystick and NETMFx.Math projects in the NETMFx source code download.

There is also a “Samples” project in the NETMFx solution where I’ve posted a sample project called “Joystick Tutorial” that is specific to this post.  I’ve done a fairly complete job of documenting the project from the code so I will not bother going into detail in this post.  Feel free to contact me if you need further clarification of how to run the code once you have everything wired up.

Thursday, September 8, 2011

Sawdust - Entertainment Center

I just realized that Software & Sawdust is really all software and no sawdust at the moment...  So, to break things up a little I'm digging up a project I finished last year - a custom built entertainment center.  I keep my woodworking project details on the site.  Read more about this project and a few of my other projects.  As the weather is cooling down, I'll be getting out in the new workshop more in the next few months.  We built a new house this year and are in need of a lot of bookshelves and my home office has a lot of needs.  Where to begin...?