Friday, March 1, 2013

Test code for ADK on Arduino Due

Arduino 1.5 BETA come with a ADK Terminal Test example to demonstrates USB Host connectivity between an Android phone and an Arduino Due. The ADK for the Arduino Due is a work in progress. For additional information on the Arduino ADK visit

To load the ADK Terminal Test example, select File in Arduino IDE -> Examples -> USBHost -> ADKTerminalTest.

Open ADK Terminal Test
Open ADK Terminal Test not work in my case! The function Serial.begin(9600) have to be called at the beginning of setup(). After then, it work as expected (view the video). From the thread



 ADK Terminal Test

 This demonstrates USB Host connectivity between an 
 Android phone and an Arduino Due.

 The ADK for the Arduino Due is a work in progress
 For additional information on the Arduino ADK visit

 created 27 June 2012
 by Cristian Maglie


#include "variant.h"
#include <stdio.h>
#include <adk.h>

// Accessory descriptor. It's how Arduino identifies itself to Android.
char applicationName[] = "Arduino_Terminal"; // the app on your phone
char accessoryName[] = "Arduino Due"; // your Arduino board
char companyName[] = "Arduino SA";

// Make up anything you want for these
char versionNumber[] = "1.0";
char serialNumber[] = "1";
char url[] = "";

USBHost Usb;
ADK adk(&Usb, companyName, applicationName, accessoryName,versionNumber,url,serialNumber);

void setup()
        Serial.begin(9600);  //<-- need to add
 printf("\r\nADK demo start\r\n");

#define RCVSIZE 128

void loop()
 uint8_t buf[RCVSIZE];
 uint32_t nbread = 0;
 char helloworld[] = "Hello World!\r\n";


 if (adk.isReady())
  /* Write hello string to ADK */
  adk.write(strlen(helloworld), (uint8_t *)helloworld);


  /* Read data from ADK and print to UART */, RCVSIZE, buf);
  if (nbread > 0)
   printf("RCV: ");
   for (uint32_t i = 0; i < nbread; ++i)
    printf("%c", (char)buf[i]);


Similar Android example with source code found, refer:

No comments:

Post a Comment