![](/media/cache/profiles/25a76ba89c58a499eadfd4cb8ecf8af5.jpg.50x50_q85.jpg)
Bus comms (external protocol) with xbee code for coordinator
Dependencies: C12832_lcd mbed xbee_lib
Revision 0:bf3639924624, committed 2015-02-15
- Comitter:
- dannellyz
- Date:
- Sun Feb 15 06:26:25 2015 +0000
- Commit message:
- Round 1 Bus comms (external protocol) with xbee
Changed in this revision
diff -r 000000000000 -r bf3639924624 C12832_lcd.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Sun Feb 15 06:26:25 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/C12832_lcd/#8f86576007d6
diff -r 000000000000 -r bf3639924624 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Feb 15 06:26:25 2015 +0000 @@ -0,0 +1,59 @@ +#include "mbed.h" +#include "xbee.h" // Include for xbee code +#include "C12832_lcd.h" // Include for LCD code + +xbee xbee1(p9,p10,p30); //Initalise xbee_lib varName(rx,tx,reset) +DigitalOut rst1(p30); +Serial pc(USBTX, USBRX); //Initalise PC serial comms +C12832_LCD lcd; //Initialize LCD Screen + +//Initialize the Bus LEDs on appBoard +BusOut leds(LED1,LED2,LED3,LED4); +int main() +{ + // reset the xbees (at least 200ns) + rst1 = 0; + wait_ms(1); + rst1 = 1; + wait_ms(1); + //Setup LCD screen + lcd.cls(); + lcd.locate(0,1); + + char readData[1]; //Buffer to read value of bus + + while(1) { + xbee1.RecieveData(readData,0); //Read data from the XBee + + //Local echo in terminal + pc.printf("Value of Bus%d \n",readData); + + //and on LCD + lcd.printf("%c\n",readData[0]); + wait(0.1); + + //Switch to change LEDs based on Bus value + switch(readData[0]){ + case '0': + leds = 0; + break; //optional + case '1': + leds = 1; + break; //optional + case '2': + leds = 2; + break; //optional + case '4': + leds = 4; + break; //optional + case '8': + leds = 8; + break; //optional + case '9': + leds = 0xFFFF; + break; //optional + +} + + } +} \ No newline at end of file
diff -r 000000000000 -r bf3639924624 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Feb 15 06:26:25 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file
diff -r 000000000000 -r bf3639924624 xbee_lib.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xbee_lib.lib Sun Feb 15 06:26:25 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tristanjph/code/xbee_lib/#ede20c047d8b