It's working D:
Dependencies: mbed
Revision 1:2dd437f51e66, committed 2015-05-12
- Comitter:
- poehalcho
- Date:
- Tue May 12 09:00:10 2015 +0000
- Parent:
- 0:3ca0cae21204
- Commit message:
- newer version. Hopefully cleaner, but I don't remember anymore... probably not much change.
Changed in this revision
main.cpp | Show diff for this revision Revisions of this file |
xbee_read.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 23 09:12:41 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -#include "mbed.h" - -Serial xbee1(PA_9, PA_10); //was PA_2, PA_3 -DigitalOut rst1(PA_11); -DigitalOut myled(LED1); -DigitalIn mybutton(USER_BUTTON); - -int main() { - rst1 = 0; //Set reset pin to 0 - myled = 0; - wait_ms(1); - rst1 = 1; //Set reset pin to 1 - wait_ms(1); - wait(2); - - while (1) { - - if(xbee1.readable()){ - int a = 0; - a = xbee1.getc(); //XBee read - - if (a == 5){ - myled = 1; //blink spastically - wait(0.2); - myled = 0; - wait(0.2); - } - if (a == 10){ - myled = 1; - wait(3); - myled = 0; - } - } - } -} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xbee_read.cpp Tue May 12 09:00:10 2015 +0000 @@ -0,0 +1,37 @@ +#include "mbed.h" + +Serial xbee1(PA_9, PA_10); //was PA_2, PA_3 +DigitalOut rst1(PA_11); +DigitalOut myled(LED1); +DigitalIn mybutton(USER_BUTTON); + +int main() { + rst1 = 0; //Set reset pin to 0 + myled = 0; + wait_ms(1); + rst1 = 1; //Set reset pin to 1 + wait_ms(1); + wait(2); + + while (1) { + + if(xbee1.readable()){ + int a = 0; + a = xbee1.getc(); //XBee read + + if (a == 5){ + myled = 1; //blink spastically +// wait(0.2); +// myled = 0; +// wait(0.2); + } + else if (a == 10){ + myled = 0; + //wait(3); + } + else{ + myled = 0; + } + } + } +} \ No newline at end of file