![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Programa de movimientos para robot-playa
Diff: main.cpp
- Revision:
- 0:4b6a4955d87f
diff -r 000000000000 -r 4b6a4955d87f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Nov 05 04:20:04 2014 +0000 @@ -0,0 +1,44 @@ +#include "mbed.h" + +Serial RC(p13,p14); +Serial PC(USBTX,USBRX); +DigitalOut l(LED4); + +char com; + +void F(){RC.putc(95);RC.putc(223);} +void I(){RC.putc(95);RC.putc(160);} +void DL(){RC.putc(33);RC.putc(223);} +void D(){RC.putc(1);RC.putc(255);} +void S(){RC.putc(64);RC.putc(192);} + +int main() +{ + while(1) + { + + + if (PC.readable()) + { + com=PC.getc(); + + if(com=='a')//FRENTE + {F();l=0;} + + if(com=='n')//DERECHA L + {DL();l=0;} + + if(com=='d')//DERECHA R + {D();l=0;} + + if(com=='z')//IZQUIERDA L + {I();l=0;} + + if(com=='s')//STOP + {S();l=0;} + + if(com=='l')//Stop Lata + {S();l=1;} + } + } +}