RN-42 Hello World experiments

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 Serial pc(USBTX, USBRX);
00005 
00006 DigitalOut RN42_led(LED1);
00007 DigitalOut pc_led(LED2);
00008 
00009 int main() {
00010 
00011     RN42.baud(115200);
00012     pc.baud(115200);
00013 
00014     while(1) {
00015         if(pc.readable()) {
00016             RN42.putc(pc.getc());
00017             pc_led = !pc_led;
00018         }
00019         if(RN42.readable()) {
00020             pc.putc(RN42.getc());
00021             RN42_led = !RN42_led;
00022         }
00023     }
00024 }