topamax once a day

Android + IOIO + Simple Digital Output

  

Simplest possible digital output with Android and IOIO. This article will discuss the bare minimal requirements for development of an Android USB (or Bluetooth) digital output device. The goal is to demonstrate the easiest possible use of the technology. For additional background information on Android development, IOIO, and electronics, check out these links:

Meet IOIO
IOIO for Android Beginners Guide
IOIO Wiki
Android Developer’s Guide

 

Hardware

Parts needed:

  • Android Device (1.6+, 2.1 for Bluetooth)
  • IOIO (available at Sparkfun)
  • 3x LED Lights
  • 3x 330 ohms resistors
  • Breadboard
  • Power supply
  • Hook-up wire

 

Assembly

Connect the 330 ohm resistors in series with the anodes of the LEDs to the desired digital output pins, and the cathodes of the LEDs to ground. The example uses digital pins 34, 35, and 36, but can be used with any IO pin (all IOIO pins are GPIO pins). The resistors, in this case, are being used to prevent current overdraw to the LEDs. 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_simple_digital_output.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.

 

19 Comments

  1. Abuhena Azad

    Thanks a lot for this.

    Have you tried having the button send a single impulse response?

  2. Which library file need to import from the list of ioio library project?

  3. Hi Michael, how the application works in the background.

  4. You’ve got the best IOIO examples on the net! Very well done!

  5. sorry could i ask , why i cannot compile the code …got 29 error ….may i know what problem ? …my eclipse is the latest version .

  6. http://img841.imageshack.us/img841/9634/errorfe.png

    the pic …hope u can help me solve the problem

  7. thank …i solve the problem…thank for sharing the example :) u are the good person :)

  8. hello, are my first programs IOIO OTG, and I have a fatal error AbstractIOIOActivity extiends where I get this error (The AbstractIOIOActivity is deprecated) I can not compile … as I can correct?

  9. How can we setup libraries? I understan nothing from Sparkfun’s web site.. They says u must download App-IOIOxxxx what does it mean? whats software/library version number??? Can you explain with a simle english please? What will we do step by step? Thank you…,

  10. Which folders are the library? Please help…

  11. When I import Your IOIOLib in Software folder as a lib in project i take this mistake
    ioio.lib.util.AbstractIOIOActivity

    Deprecated. Please use ioio.lib.util.android.IOIOActivity instead.

    A convenience class for easy creation of IOIO-based applications. It is used by creating a concrete Activity in your application, which extends this class. This class then takes care of proper creation and abortion of the IOIO connection and of a dedicated thread for IOIO communication. In the basic usage the client should extend this class and implement createIOIOThread(), which should return an implementation of the AbstractIOIOActivity.IOIOThread abstract class. In this implementation, the client implements the AbstractIOIOActivity.IOIOThread.setup() method, which gets called as soon as communication with the IOIO is established, and the AbstractIOIOActivity.IOIOThread.loop() method, which gets called repetitively as long as the IOIO is connected. Both methods should access the AbstractIOIOActivity.IOIOThread.ioio_ field for controlling the IOIO. In addition, the AbstractIOIOActivity.IOIOThread.disconnected() method may be overridden in order to execute logic as soon as a disconnection occurs for whichever reason. The AbstractIOIOActivity.IOIOThread.incompatible() method may be overridden in order to take action in case where a IOIO whose firmware is incompatible with the IOIOLib version that application is built with. In a more advanced use case, more than one IOIO is available. In this case, a thread will be created for each IOIO, whose semantics are as defined above. If the client needs to be able to distinguish between them, it is possible to override createIOIOThread(String, Object) instead of createIOIOThread(). The first argument provided will contain the connection class name, such as ioio.lib.impl.SocketIOIOConnection for a connection established over a TCP socket (which is used over ADB). The second argument will contain information specific to the connection type. For example, in the case of SocketIOIOConnection, the second argument will contain an Integer representing the local port number.

  12. When I run the project i take this mistakes on console what does it mean? The project is run but not working the buttons..
    [2014-01-11 01:49:31 - SimpleDigitalOutputActivity] Android Launch!
    [2014-01-11 01:49:31 - SimpleDigitalOutputActivity] adb is running normally.
    [2014-01-11 01:49:31 - SimpleDigitalOutputActivity] Performing net.mitchtech.ioio.SimpleDigitalOutputActivity activity launch
    [2014-01-11 01:49:31 - SimpleDigitalOutputActivity] WARNING: Application does not specify an API level requirement!
    [2014-01-11 01:49:31 - SimpleDigitalOutputActivity] Device API version is 15 (Android 4.0.4)
    [2014-01-11 01:49:31 - SimpleDigitalOutputActivity] Uploading SimpleDigitalOutputActivity.apk onto device ‘BX902VYUKP’
    [2014-01-11 01:49:31 - SimpleDigitalOutputActivity] Installing SimpleDigitalOutputActivity.apk…
    [2014-01-11 01:49:32 - SimpleDigitalOutputActivity] Re-installation failed due to different application signatures.
    [2014-01-11 01:49:32 - SimpleDigitalOutputActivity] You must perform a full uninstall of the application. WARNING: This will remove the application data!
    [2014-01-11 01:49:32 - SimpleDigitalOutputActivity] Please execute ‘adb uninstall net.mitchtech.ioio.simpledigitaloutput’ in a shell.
    [2014-01-11 01:49:32 - SimpleDigitalOutputActivity] Launch failed on device: BX902VYUKP
    [2014-01-11 01:49:32 - SimpleDigitalOutputActivity] Starting activity net.mitchtech.ioio.SimpleDigitalOutputActivity on device BX902VYUKP
    [2014-01-11 01:49:32 - SimpleDigitalOutputActivity] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=net.mitchtech.ioio.simpledigitaloutput/net.mitchtech.ioio.SimpleDigitalOutputActivity }

  13. when i run your apk the buttons blink my leds.. But when i run on source on eclipse. The program run on my phone but buttons have no action.. Buttons not work not blink my leds. why?

  14. where i can buy IOIO android

  15. Hello michael,
    I have got the ioio OTG, I have read the sparkfun tuts and and github stuff and some jaycon tuts too. I am unable to figure out what are the exact steps to use and program the board. For example, it’s been very easy for Arduino UNO, like Get the board, code in arduino IDE, burn the code using USB and start using immediately. I am a lot confused with this ioio OTG. I m not understanding the hierarchy, somewhere I am importing the code , importing libraries, connecting phone, not burning the code into ioio rather just installing app into the android phone. then how come all this is happening. There are no programming videos available except one or two.
    Will you please elaborate the hierarchy and steps of using and tell me which step is responsible for what ? All those people just put shitty videos about what they have done with ioio and not how they have done it.
    Revert.

Leave a Reply