Raciel Flores Benítez
/
Liditek_XBee_Maestro
Maestro
main.cpp@0:a68449ee4734, 2017-03-03 (annotated)
- Committer:
- Sumobot
- Date:
- Fri Mar 03 06:21:42 2017 +0000
- Revision:
- 0:a68449ee4734
Mestro
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sumobot | 0:a68449ee4734 | 1 | #include "mbed.h" |
Sumobot | 0:a68449ee4734 | 2 | Serial xbee(p9,p10); |
Sumobot | 0:a68449ee4734 | 3 | DigitalOut myled(LED1); |
Sumobot | 0:a68449ee4734 | 4 | DigitalOut myled2(LED2); |
Sumobot | 0:a68449ee4734 | 5 | Serial pc(USBTX, USBRX); |
Sumobot | 0:a68449ee4734 | 6 | DigitalIn a(p12); |
Sumobot | 0:a68449ee4734 | 7 | DigitalIn b(p13); |
Sumobot | 0:a68449ee4734 | 8 | int dis, sub; |
Sumobot | 0:a68449ee4734 | 9 | //DigitalIn c(p23); |
Sumobot | 0:a68449ee4734 | 10 | //DigitalIn d(p24); |
Sumobot | 0:a68449ee4734 | 11 | |
Sumobot | 0:a68449ee4734 | 12 | int main() { |
Sumobot | 0:a68449ee4734 | 13 | pc.baud(9600); |
Sumobot | 0:a68449ee4734 | 14 | while(1) { |
Sumobot | 0:a68449ee4734 | 15 | if(a==1) |
Sumobot | 0:a68449ee4734 | 16 | { |
Sumobot | 0:a68449ee4734 | 17 | dis = 0; |
Sumobot | 0:a68449ee4734 | 18 | sub = 0; |
Sumobot | 0:a68449ee4734 | 19 | xbee.printf("E.A,%D:%D\n", sub, dis); |
Sumobot | 0:a68449ee4734 | 20 | myled = !myled; |
Sumobot | 0:a68449ee4734 | 21 | wait(1); |
Sumobot | 0:a68449ee4734 | 22 | } |
Sumobot | 0:a68449ee4734 | 23 | if(b==1) |
Sumobot | 0:a68449ee4734 | 24 | { |
Sumobot | 0:a68449ee4734 | 25 | sub = 1; |
Sumobot | 0:a68449ee4734 | 26 | dis = 1; |
Sumobot | 0:a68449ee4734 | 27 | xbee.printf("E.A,%D:%D\n", sub, dis); |
Sumobot | 0:a68449ee4734 | 28 | myled2 = !myled2; |
Sumobot | 0:a68449ee4734 | 29 | wait(1); |
Sumobot | 0:a68449ee4734 | 30 | } |
Sumobot | 0:a68449ee4734 | 31 | } |
Sumobot | 0:a68449ee4734 | 32 | } |
Sumobot | 0:a68449ee4734 | 33 |