
Add to Cart
Arduino USB Host Shield compatible with Google Android ADK supports the UNO MEGA
Description:
USB Host Shield is an Arduino USB Host expansion board. Can be plugged into the Arduino board with USB Host function. Host function of Ardhuino have a lot of features to achieve, for example, support U disk, USB keyboard and mousesupport, support for USB cameras.
In these functions inside, undoubtedly the most attractive android phone supportconnectivity to achieve Google ADK functionality. This makes it possible to use the phone as a control terminal to control your robot or other device, you can also collecta variety of back end data in the phone display.
The first step, material preparation, now if you want to support Google ADK function, need to Android phones firmware v2.3.4 or later is supported. Here we use the Nexus S firmware version is v2.3.4
The second step, burned into the Arduino board demo code, downloadadk_release_0512.zip the "AndroidAccessory" and "USB_Host_Shield1" libraryinto the ... arduino-0022 libraries below. Arduino burned into us over the Android LED test code.
Installed on an Android phone USB
host test APK:
Part III, as shown in Figure connected.
Step four: After a successful connection, APK interface after the jump to find theUSB host control interface, click the OUT button, the control interface is as follows, insliding the mouse button, you can control the LED light off and brightness.
Arduino LED - USB host control demo:
#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory.h>
#define LED 8
AndroidAccessory acc("Google, Inc.",
"DemoKit",
"DemoKit Arduino Board",
"1.0",
"http://www.android.com",
"0000000012345678");
void setup()
{
Serial.begin(115200);
Serial.print("rnStart");
acc.powerOn();
pinMode(LED, OUTPUT);
digitalWrite(LED, 0);
}
void loop()
{
byte msg[3];
if (acc.isConnected()) {
Serial.print("Accessory connected. ");
int len = acc.read(msg, sizeof(msg), 1);
Serial.print("Message length: ");
Serial.println(len, DEC);
if (len > 0) {
// assumes only one command per packet
if (msg[0] == 0x2) {
if (msg[1] == 0x0)
analogWrite(LED, msg[2]);
}
}
}
delay(100);
}