Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of IEEE_14_Freescale by
Diff: main.cpp
- Revision:
- 1:c28fac16a109
- Parent:
- 0:3a3dd78038a6
- Child:
- 2:7c6b494f9005
diff -r 3a3dd78038a6 -r c28fac16a109 main.cpp --- a/main.cpp Fri Nov 15 17:33:59 2013 +0000 +++ b/main.cpp Sun Nov 17 03:05:35 2013 +0000 @@ -1,12 +1,43 @@ #include "mbed.h" +#include "dbgprint.h" +#include "robot.h" -DigitalOut myled(LED1); +BusOut leds(LED_RED,LED_GREEN,LED_BLUE); +Serial pc(USBTX, USBRX); +robot bot; int main() { + DBGPRINT("AA\n\r",1); + char tmpchar = 0; + leds = 0x2; + const int* constbuf; while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); + DBGPRINT("BB\n\r",1); + leds = leds^0x7; + tmpchar = pc.getc(); + + switch(tmpchar){ + case 'q': + constbuf = bot.bigenc.getVals(); + DBGPRINT("\n\r%d\t%d\t%d\t%d\n\r",constbuf[0],constbuf[1],constbuf[2],constbuf[3]); + break; + case 'w': + bot.left.setPower(0.2); + bot.right.setPower(0.2); + break; + case 'a': + bot.left.setPower(-0.2); + bot.right.setPower(0.2); + break; + case 'd': + bot.left.setPower(0.2); + bot.right.setPower(-0.2); + break; + default: + bot.left.brake(); + bot.right.brake(); + break; + + } } }