Advertisement
Guest User

Untitled

a guest
Jan 11th, 2012
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <Max3421e.h>
  2. #include <Usb.h>
  3. #include <AndroidAccessory.h>
  4.  
  5. AndroidAccessory acc("Google, Inc.",
  6.              "DemoKit",
  7.              "DemoKit Arduino Board",
  8.              "1.0",
  9.              "http://www.android.com",
  10.              "0000000012345678");
  11. void setup();
  12. void loop();
  13.  
  14. void setup()
  15. {
  16.     Serial.begin(115200);
  17.     Serial.print("\r\nStart");
  18.     acc.powerOn();
  19. }
  20.  
  21. void loop()
  22. {
  23.   byte msg[3];
  24.  
  25.     if (acc.isConnected()) {
  26.                 Serial.print("Accessory connected. ");
  27.         int len = acc.read(msg, sizeof(msg), 1);
  28.                 Serial.print("Message length: ");
  29.                 Serial.println(len, DEC);
  30.         }
  31.  
  32.     delay(100);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement