Android + IOIO + D-Pad
A simple controller for use as an Android D-pad (directional pad) input accessory. The IOIO based device uses four momentary push buttons to sense digital inputs for up, down, left, and right.
For additional background information on interfacing Android with IOIO, check out my other introductory tutorials:
Android + IOIO + Simple Digital Output
Android + IOIO + Simple Digital Input
Android + IOIO + Simple Analog Output
Android + IOIO + Simple Analog Input
Background on Android development, IOIO, and electronics:
IOIO for Android Beginners Guide
Hardware
Parts needed:
-
Android Device (1.6+, 2.1 for Bluetooth)
-
IOIO (available at Sparkfun)
-
4x Push button
-
Breadboard
-
Power supply
-
Hook-up wire
Assembly
Connect one side of each button to ground and the other side to the desired digital input pins on the IOIO. The example uses pins 34-37, but can be used with any IO pins (all IOIO pins are GPIO pins). Here is a diagram of the completed circuit (created with Fritzing):
Software
Get the source
With the circuit assembled, the next step is to get the demo application on the Android device. You can either download the pre-built .apk or checkout the source from Github:
git clone git://github.com/mitchtech/android_ioio_d_pad.git
If you are building from source, you will also need to import the IOIO Library project, and optionally the IOIO Bluetooth library projects, both available here:
git clone git://github.com/ytai/ioio.git
Install, connect, profit!
Finally, upload the app to the Android device (or browse to this page on the device and download the apk above). Connect the device to the IOIO, and start up the app.