
version2...
Dependencies: mbed
main.cpp
- Committer:
- poehalcho
- Date:
- 2015-04-23
- Revision:
- 2:238093c1d98d
- Parent:
- 1:4a28329e243f
File content as of revision 2:238093c1d98d:
#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; } }