Xbee receiver

Dependencies:   C12832 mbed

main.cpp

Committer:
nnoitre
Date:
2016-03-10
Revision:
0:b78d22fdc409
Child:
1:30d319218526

File content as of revision 0:b78d22fdc409:

#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();
            }
        }
    }
}