Tuesday, April 12, 2011

Milestone 1 Complete

Here's something I managed to throw together this afternoon:
Sorry to whoever's ESE 171 board that USB cable was for... :)
The white cable you see is a standard USB cable.  I cut the cable open, separated the red (+5V), black (ground), green (D+), and white (D-) wires, and then connected the D+ and D- wires to the corresponding pins on the mbed.

Using modified code from mbed.org, I managed to make the mbed use four ADC inputs and twelve GPIO pins to implement a 4-axis, 12-button game controller that uses the USB HID (human interface device) protocol.  This means, of course, that if those pins on the mbed were actually connected to buttons and joysticks, you could use this to play games on PC already!

It even successfully identifies as a game controller (with the proper buttons/sticks) in Windows 7:
Generic "USB Input Device" FTW
It will even recognize button presses if we connect the mbed's 3.3V regulated output to one of those 12 GPIO pins!  Unfortunately, I don't have a pot on hand to test the analog functionality... this will wait until one of us makes it to the lab.

Technically, this means our first (albeit relatively simple) milestone is complete!  To anyone who is currently still deciding on a micro-controller to use, from our experience so far, I strongly recommend looking into the mbed.  If you can get over writing in C++ and having to use the online IDE/compiler, the community seems great (it didn't take me long at all to find both a guide and the majority of the source code I used for HID), the board is loaded with peripheral features, and the libraries available online are pretty extensive.


Paul

No comments:

Post a Comment