
version2...
Dependencies: mbed
Diff: main.cpp
- Revision:
- 4:b8207ce97856
- Parent:
- 2:238093c1d98d
--- a/main.cpp Thu Apr 23 09:14:44 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -#include "mbed.h" -#include "stdio.h" -#include "stdlib.h" - -using namespace std; - -Serial xbee1(PA_9, PA_10); //was PA_2, PA_3 -DigitalOut rst1(PA_11); -DigitalOut myled(LED1); -DigitalIn mybutton(USER_BUTTON); - -int counter = 0; -void sendsignal(); - -int main() -{ - - while(1) { - if (mybutton == 0) { //if button pressed - sendsignal(); - } - rst1 = 0; //Set reset pin to 0 - myled = 0; - wait_ms(1); - rst1 = 1; //Set reset pin to 1 - wait_ms(1); - wait(2); - } -} - -void sendsignal() -{ - if(counter == 0) { - xbee1.putc(10); //XBee write - myled = 1; // LED is ON - wait(1); - counter++; - } - else if (counter == 1) { //this one doesn't work for some reason :/ - xbee1.putc(5); - counter = 0; - myled = 1; // LED is ON - wait(0.2); - myled = 0; - wait(0.2); - myled = 1; // LED is ON - wait(0.2); - myled = 0; - } -}