Zac Dannelly
/
serial2Way
2-way comms for mbed appBoard and Xbees
Diff: main.cpp
- Revision:
- 2:80be7d8aaaa3
- Parent:
- 1:2513e17b33db
diff -r 2513e17b33db -r 80be7d8aaaa3 main.cpp --- a/main.cpp Sun Feb 15 04:23:16 2015 +0000 +++ b/main.cpp Sun Feb 15 04:47:03 2015 +0000 @@ -7,6 +7,7 @@ //Code to send and recieve serial comms on //mbed appBoard with xbees #include "mbed.h" +#include "C12832_lcd.h" // Include for LCD code //Initialize xbee Serial xbee(p9, p10); @@ -14,20 +15,32 @@ //Initialize terminal Serial pc(USBTX, USBRX); + +//Initialize lcd +C12832_LCD lcd; int main() { - // reset the xbees (at least 200ns) rst1 = 0; wait_ms(1); rst1 = 1; - wait_ms(1); + wait_ms(1); + //Setup LCD screen + lcd.cls(); //...they want to see which parameters they want to edit + lcd.locate(0,1); while(1) { + //variable to get data from xbee + char toPrint; + + //If terminal data available send through xbee if(pc.readable()) { xbee.putc(pc.getc()); } + //If xbee gets data send to terminal and lcd screen if(xbee.readable()) { - pc.putc(xbee.getc(); + toPrint = xbee.getc(); + pc.putc(toPrint); + lcd.printf("%c",toPrint); } } } \ No newline at end of file