

Git clone git:///mitchtech/android_adb_simple_digital_output.gitįinally upload the app to the device (or browse to this page on the device and download the apk above).
Arduino usb host shield 2 install#
Use any unused port number eg:4568Ĭonnection = ADB::addConnection("tcp:4568", true, adbEventHandler) įinally, install the Android Demo application onto the device. Open an ADB stream to the phone's shell. PinMode(i+2,OUTPUT) // Set pins as output LEDState = data // Store the State of LED Serial.println(data,DEC) // Output debugging to serial In this example Data packets contain three bytes: one for the state of each LEDĭigitalWrite(i+2, data) // Change the state of LED Void adbEventHandler(Connection * connection, adb_eventType event, uint16_t length, uint8_t * data) Event handler for shell connection called whenever data sent from Android to Microcontroller You can checkout the source for the Arduino sketch from Github, or just copy and paste the following into the Arduino IDE. Microbridge uses Android Debug Bridge (ABD) forwarding over TCP, rather than the official Google Android ADK. The sketch uses the Microbridgeimplementation by Niels Brouwers. Next, upload the Arduino sketch to the microcontroller. Here is a diagram of the completed circuit (created with Fritzing): The resistors, in this case, are being used to prevent current overdraw to the LEDs. The example uses digital pins 2, 3, and 4, but can be used with any IO pin that doesn’t interfere with the SPI communication with the USB Host Board. Google ADK board, Freeduino ADK board , Seeed Studio ADK board, and DIY Drones ADK boardĬonnect 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. For additional background information on Android development, Arduino, and MicroBridge, check out these links:įirst, make sure you have setup the development environments for Arduino and Android: The goal is to demonstrate the easiest possible use of the technology. This article will discuss the bare minimal requirements for development of an Android USB digital output device.

Simplest possible digital output with Android and Arduino.
