Receive data from maxbotix rangefinder with xbee. Illuminate BUS leds if something is within 2 feet.
Dependencies: C12832_lcd mbed xbee_lib
Revision 0:0ae2b2f49936, committed 2015-02-16
- Comitter:
- dannellyz
- Date:
- Mon Feb 16 02:28:48 2015 +0000
- Commit message:
- round 1;
Changed in this revision
diff -r 000000000000 -r 0ae2b2f49936 C12832_lcd.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Mon Feb 16 02:28:48 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/C12832_lcd/#8f86576007d6
diff -r 000000000000 -r 0ae2b2f49936 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 16 02:28:48 2015 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" +#include "xbee.h" +#include "C12832_lcd.h" // Include for LCD code +#include <stdio.h> +xbee xbee1(p9,p10,p30); //Initalise xbee_lib +Serial pc(USBTX, USBRX); //Initalise PC serial comms +C12832_LCD lcd; +BusOut leds(LED1,LED2,LED3,LED4); +int main() { + char read_data[2]; //Xbee buffer size is 202 bytes + int out = 0; + while(1) { + xbee1.RecieveData(read_data,2); //Read data from the XBee + out = atoi(read_data); + //If something is closer than 2ft illumiate BUS leds + if(out < 24){ + leds = 0xFFFF; + } + else{leds = 0;} + pc.printf("Range: %s \r",read_data); + lcd.cls(); + lcd.locate(0,2); + lcd.printf("Range: %s \r",read_data); + wait(.1); + } +}
diff -r 000000000000 -r 0ae2b2f49936 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Feb 16 02:28:48 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 0ae2b2f49936 xbee_lib.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xbee_lib.lib Mon Feb 16 02:28:48 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tristanjph/code/xbee_lib/#ede20c047d8b