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 03:05:35 2013 +0000
Revision:
1:c28fac16a109
Parent:
0:3a3dd78038a6
Child:
2:7c6b494f9005
Added encoder direction settings and setup motors and encoders

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 1:c28fac16a109 29 bot.left.setPower(-0.2);
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 1:c28fac16a109 34 bot.right.setPower(-0.2);
soonerbot 1:c28fac16a109 35 break;
soonerbot 1:c28fac16a109 36 default:
soonerbot 1:c28fac16a109 37 bot.left.brake();
soonerbot 1:c28fac16a109 38 bot.right.brake();
soonerbot 1:c28fac16a109 39 break;
soonerbot 1:c28fac16a109 40
soonerbot 1:c28fac16a109 41 }
soonerbot 0:3a3dd78038a6 42 }
soonerbot 0:3a3dd78038a6 43 }