USB Host Shield

Introduction :
USB Host Shield is an Arduino USB Host expansion board . Can be plugged into the Arduino board with USB Host
Function . With the Host function Ardhuino can achieve a lot of features, such as support U disk , support for USB keyboard and mouse ,
Support for USB cameras.
In these functions inside, undoubtedly the most attractive android phone supports connection to achieve Google ADK function . So
It makes it possible to use the phone as a control terminal to control your robot or other device , but can also be collected back each
Types of data in the mobile terminal display .
The first step , material preparation , and is currently supported by Google ADK function if you want to , need Android phone firmware v2.3.4 or
Is supported by later versions . Here we are using the Nexus S firmware version is v2.3.4
A more detailed description ADK , see the official website :
http://developer.android.com/guide/topics/usb/adk.html
The second step in the Arduino board burned into the demo code in the downloaded adk_release_0512.zip
"AndroidAccessory" and "USB_Host_Shield1" library into the ... \ arduino-0022 \ libraries \ below .
Arduino burned into us over Android LED test code.
Installed on your Android phone USB host test APK:
demo apk USB Host Shield Library 1.0: https://github.com/felis/USB_Host_Shield/tree/dev
demo apk USB Host Shield Library 2.0: https://github.com/felis/USB_Host_Shield_2.0
ADK Arduino Library: https://dl-ssl.google.com/android/adk/adk_release_0512.zip
The third step , as shown in the connection.
Step Four: After a successful connection , APK find USB host interface control interface after the jump , click the OUT button control interface
Below , the sliding 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 ("\ r \ nStart");
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);
}
Related Links
Official· website : http://www.circuitsathome.com/category/mcu/arduino
Library file :· https://github.com/felis/USB_Host_Shield_2.0


· How to create ADK hardware platforms

: http://www.circuitsathome.com/mcu/building-google-adk-hardware-from-standard-components