Sooner Competitive Robotics / Mbed 2 deprecated IEEE_14_Freescale

Dependencies:   mbed

Fork of IEEE_14_Freescale by IEEE 2014 Mbed

Committer:
soonerbot
Date:
Sun Nov 17 04:15:18 2013 +0000
Revision:
3:a223b0bf8256
Parent:
2:7c6b494f9005
Child:
4:adc885f4ab75
Gyro working

Who changed what in which revision?

UserRevisionLine numberNew contents of line
soonerbot 0:3a3dd78038a6 1 #include "mbed.h"
soonerbot 1:c28fac16a109 2 #include "dbgprint.h"
soonerbot 1:c28fac16a109 3 #include "robot.h"
soonerbot 0:3a3dd78038a6 4
soonerbot 1:c28fac16a109 5 BusOut leds(LED_RED,LED_GREEN,LED_BLUE);
soonerbot 1:c28fac16a109 6 Serial pc(USBTX, USBRX);
soonerbot 0:3a3dd78038a6 7
soonerbot 1:c28fac16a109 8 robot bot;
soonerbot 0:3a3dd78038a6 9 int main() {
soonerbot 1:c28fac16a109 10 DBGPRINT("AA\n\r",1);
soonerbot 1:c28fac16a109 11 char tmpchar = 0;
soonerbot 1:c28fac16a109 12 leds = 0x2;
soonerbot 1:c28fac16a109 13 const int* constbuf;
soonerbot 0:3a3dd78038a6 14 while(1) {
soonerbot 1:c28fac16a109 15 DBGPRINT("BB\n\r",1);
soonerbot 1:c28fac16a109 16 leds = leds^0x7;
soonerbot 1:c28fac16a109 17 tmpchar = pc.getc();
soonerbot 1:c28fac16a109 18
soonerbot 1:c28fac16a109 19 switch(tmpchar){
soonerbot 1:c28fac16a109 20 case 'q':
soonerbot 1:c28fac16a109 21 constbuf = bot.bigenc.getVals();
soonerbot 1:c28fac16a109 22 DBGPRINT("\n\r%d\t%d\t%d\t%d\n\r",constbuf[0],constbuf[1],constbuf[2],constbuf[3]);
soonerbot 1:c28fac16a109 23 break;
soonerbot 1:c28fac16a109 24 case 'w':
soonerbot 1:c28fac16a109 25 bot.left.setPower(0.2);
soonerbot 1:c28fac16a109 26 bot.right.setPower(0.2);
soonerbot 1:c28fac16a109 27 break;
soonerbot 1:c28fac16a109 28 case 'a':
soonerbot 2:7c6b494f9005 29 bot.left.setPower(-0.1);
soonerbot 1:c28fac16a109 30 bot.right.setPower(0.2);
soonerbot 1:c28fac16a109 31 break;
soonerbot 1:c28fac16a109 32 case 'd':
soonerbot 1:c28fac16a109 33 bot.left.setPower(0.2);
soonerbot 2:7c6b494f9005 34 bot.right.setPower(0.1);
soonerbot 1:c28fac16a109 35 break;
soonerbot 3:a223b0bf8256 36 case 'p':
soonerbot 3:a223b0bf8256 37 DBGPRINT("%d\r\n",bot.gyro.getZ());
soonerbot 3:a223b0bf8256 38 break;
soonerbot 3:a223b0bf8256 39 case 'l':
soonerbot 3:a223b0bf8256 40 bot.gyro.calibrate();
soonerbot 3:a223b0bf8256 41 break;
soonerbot 1:c28fac16a109 42 default:
soonerbot 1:c28fac16a109 43 bot.left.brake();
soonerbot 1:c28fac16a109 44 bot.right.brake();
soonerbot 1:c28fac16a109 45 break;
soonerbot 1:c28fac16a109 46
soonerbot 1:c28fac16a109 47 }
soonerbot 0:3a3dd78038a6 48 }
soonerbot 0:3a3dd78038a6 49 }