Mathias Peers
/
ReceiverV2
Xbee receiver
Diff: main.cpp
- Revision:
- 0:b78d22fdc409
- Child:
- 1:30d319218526
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 10 20:27:00 2016 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" + +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); +DigitalOut myled3(LED3); +DigitalOut myled4(LED4); + +InterruptIn down(p12); +InterruptIn left(p13); +InterruptIn up(p15); +InterruptIn right(p16); + +Serial xbee(p9,p10); + +char Source=0b00000010; +char Des=0b00000001; +char Item,Status,Checksum; +char Item2 = 0x01; +char Status2 = 0x01; + +bool sending=1; + +int main() { + while(1) { + if(xbee.readable()) { //Checks if the data is readable + control = xbee.getc(); //Get the first character that's in the buffer + if(control==0b00001111){ + sending=1; + } + if(control==0b11110000){ + send(); + } + } + } +}