![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Programa de movimientos para robot-playa
main.cpp@0:4b6a4955d87f, 2014-11-05 (annotated)
- Committer:
- oscarvzfz
- Date:
- Wed Nov 05 04:20:04 2014 +0000
- Revision:
- 0:4b6a4955d87f
latas
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
oscarvzfz | 0:4b6a4955d87f | 1 | #include "mbed.h" |
oscarvzfz | 0:4b6a4955d87f | 2 | |
oscarvzfz | 0:4b6a4955d87f | 3 | Serial RC(p13,p14); |
oscarvzfz | 0:4b6a4955d87f | 4 | Serial PC(USBTX,USBRX); |
oscarvzfz | 0:4b6a4955d87f | 5 | DigitalOut l(LED4); |
oscarvzfz | 0:4b6a4955d87f | 6 | |
oscarvzfz | 0:4b6a4955d87f | 7 | char com; |
oscarvzfz | 0:4b6a4955d87f | 8 | |
oscarvzfz | 0:4b6a4955d87f | 9 | void F(){RC.putc(95);RC.putc(223);} |
oscarvzfz | 0:4b6a4955d87f | 10 | void I(){RC.putc(95);RC.putc(160);} |
oscarvzfz | 0:4b6a4955d87f | 11 | void DL(){RC.putc(33);RC.putc(223);} |
oscarvzfz | 0:4b6a4955d87f | 12 | void D(){RC.putc(1);RC.putc(255);} |
oscarvzfz | 0:4b6a4955d87f | 13 | void S(){RC.putc(64);RC.putc(192);} |
oscarvzfz | 0:4b6a4955d87f | 14 | |
oscarvzfz | 0:4b6a4955d87f | 15 | int main() |
oscarvzfz | 0:4b6a4955d87f | 16 | { |
oscarvzfz | 0:4b6a4955d87f | 17 | while(1) |
oscarvzfz | 0:4b6a4955d87f | 18 | { |
oscarvzfz | 0:4b6a4955d87f | 19 | |
oscarvzfz | 0:4b6a4955d87f | 20 | |
oscarvzfz | 0:4b6a4955d87f | 21 | if (PC.readable()) |
oscarvzfz | 0:4b6a4955d87f | 22 | { |
oscarvzfz | 0:4b6a4955d87f | 23 | com=PC.getc(); |
oscarvzfz | 0:4b6a4955d87f | 24 | |
oscarvzfz | 0:4b6a4955d87f | 25 | if(com=='a')//FRENTE |
oscarvzfz | 0:4b6a4955d87f | 26 | {F();l=0;} |
oscarvzfz | 0:4b6a4955d87f | 27 | |
oscarvzfz | 0:4b6a4955d87f | 28 | if(com=='n')//DERECHA L |
oscarvzfz | 0:4b6a4955d87f | 29 | {DL();l=0;} |
oscarvzfz | 0:4b6a4955d87f | 30 | |
oscarvzfz | 0:4b6a4955d87f | 31 | if(com=='d')//DERECHA R |
oscarvzfz | 0:4b6a4955d87f | 32 | {D();l=0;} |
oscarvzfz | 0:4b6a4955d87f | 33 | |
oscarvzfz | 0:4b6a4955d87f | 34 | if(com=='z')//IZQUIERDA L |
oscarvzfz | 0:4b6a4955d87f | 35 | {I();l=0;} |
oscarvzfz | 0:4b6a4955d87f | 36 | |
oscarvzfz | 0:4b6a4955d87f | 37 | if(com=='s')//STOP |
oscarvzfz | 0:4b6a4955d87f | 38 | {S();l=0;} |
oscarvzfz | 0:4b6a4955d87f | 39 | |
oscarvzfz | 0:4b6a4955d87f | 40 | if(com=='l')//Stop Lata |
oscarvzfz | 0:4b6a4955d87f | 41 | {S();l=1;} |
oscarvzfz | 0:4b6a4955d87f | 42 | } |
oscarvzfz | 0:4b6a4955d87f | 43 | } |
oscarvzfz | 0:4b6a4955d87f | 44 | } |