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
main.cpp
- Committer:
- soonerbot
- Date:
- 2013-11-17
- Revision:
- 3:a223b0bf8256
- Parent:
- 2:7c6b494f9005
- Child:
- 4:adc885f4ab75
File content as of revision 3:a223b0bf8256:
#include "mbed.h" #include "dbgprint.h" #include "robot.h" 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) { 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.1); bot.right.setPower(0.2); break; case 'd': bot.left.setPower(0.2); bot.right.setPower(0.1); break; case 'p': DBGPRINT("%d\r\n",bot.gyro.getZ()); break; case 'l': bot.gyro.calibrate(); break; default: bot.left.brake(); bot.right.brake(); break; } } }