Raciel Flores Benítez
/
Liditek_XBee_Maestro
Maestro
Diff: main.cpp
- Revision:
- 0:a68449ee4734
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Mar 03 06:21:42 2017 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" +Serial xbee(p9,p10); +DigitalOut myled(LED1); +DigitalOut myled2(LED2); +Serial pc(USBTX, USBRX); +DigitalIn a(p12); +DigitalIn b(p13); +int dis, sub; +//DigitalIn c(p23); +//DigitalIn d(p24); + +int main() { + pc.baud(9600); + while(1) { + if(a==1) + { + dis = 0; + sub = 0; + xbee.printf("E.A,%D:%D\n", sub, dis); + myled = !myled; + wait(1); + } + if(b==1) + { + sub = 1; + dis = 1; + xbee.printf("E.A,%D:%D\n", sub, dis); + myled2 = !myled2; + wait(1); + } + } + } +