Hello World program, looping back serial data over RN42 bluetooth

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 Serial rn42(p9,p10);
00004 DigitalOut myled(LED1);
00005 
00006 int main() {
00007 
00008     rn42.baud(115200);
00009 
00010     // echo back characters, toggle the LED
00011     while (1) {
00012         if (rn42.readable()) {
00013             rn42.putc(rn42.getc());
00014             myled = !myled;
00015         }
00016     }
00017 }