4 // Satisfy IDE, which only needs to see the include statment in the ino.
6 #include <spi4teensy3.h>
13 ADK adk(&Usb,"Google, Inc.",
15 "DemoKit Arduino Board",
17 "http://www.android.com",
27 pinMode(BUTTON1, INPUT);
29 // enable the internal pullups
30 digitalWrite(BUTTON1, HIGH);
35 digitalWrite(LED1_RED, 0);
37 pinMode(LED1_RED, OUTPUT);
43 #if !defined(__MIPSEL__)
44 while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
46 Serial.println("\r\nADK demo start");
48 if (Usb.Init() == -1) {
49 Serial.println("OSCOKIRQ failed to assert");
51 }//if (Usb.Init() == -1...
56 b1 = digitalRead(BUTTON1);
62 uint8_t msg[3] = { 0x00 };
65 if( adk.isReady() == false ) {
66 analogWrite(LED1_RED, 255);
69 uint16_t len = sizeof(msg);
71 rcode = adk.RcvData(&len, msg);
73 USBTRACE2("Data rcv. :", rcode );
76 USBTRACE("\r\nData Packet.");
77 // assumes only one command per packet
81 analogWrite(LED1_RED, 255 - msg[2]);
84 }//if (msg[0] == 0x2...
89 b = digitalRead(BUTTON1);
91 USBTRACE("\r\nButton state changed");
94 rcode = adk.SndData( 3, msg );
96 USBTRACE2("Button send: ", rcode );