USB serial demo for an Android device See https://os.mbed.com/users/4180_1/notebook/using-mbed-with-an-android-phone-or-tablet/

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 //Communicate with Android using USB serial
00003 //See https://os.mbed.com/users/4180_1/notebook/using-mbed-with-an-android-phone-or-tablet/
00004 DigitalOut myled(LED1);
00005 Serial USB(USBTX,USBRX);
00006 
00007 int main() {
00008     USB.baud(19200); //set baud for Andriod App default
00009     wait(1.0);
00010     USB.printf("\n\rHello from mbed\n\r");
00011     USB.printf("Type characters, hit send, and mbed will echo them back\n\r");
00012     myled = 1;
00013     while(1) {
00014         USB.putc(USB.getc());
00015     }
00016 }