RN-42 Hello World experiments

Dependencies:   mbed

main.cpp

Committer:
simon
Date:
2012-05-27
Revision:
0:0ca40ec83ec9

File content as of revision 0:0ca40ec83ec9:

#include "mbed.h"

Serial RN42(p9, p10);
Serial pc(USBTX, USBRX);

DigitalOut RN42_led(LED1);
DigitalOut pc_led(LED2);

int main() {

    RN42.baud(115200);
    pc.baud(115200);

    while(1) {
        if(pc.readable()) {
            RN42.putc(pc.getc());
            pc_led = !pc_led;
        }
        if(RN42.readable()) {
            pc.putc(RN42.getc());
            RN42_led = !RN42_led;
        }
    }
}