Code for the car to drive in a figure eight motion

Dependencies:   mbed-rtos mbed MODSERIAL mbed-dsp telemetry

Committer:
cheryl_he
Date:
Fri Mar 20 04:25:44 2015 +0000
Revision:
14:09d61b20b102
Parent:
13:97708869a4ba
Child:
17:3b545dc0c800
figure eight with telemetry

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ericoneill 0:2002d645d2a6 1 #include "mbed.h"
ericoneill 2:3eb545c3e6a1 2 #include "rtos.h"
cheryl_he 14:09d61b20b102 3 #include "telemetry.h"
ericoneill 0:2002d645d2a6 4
ericoneill 2:3eb545c3e6a1 5 // Camera Pins
ericoneill 2:3eb545c3e6a1 6 DigitalOut clk(PTA13);
ericoneill 2:3eb545c3e6a1 7 DigitalOut si(PTD4);
ericoneill 2:3eb545c3e6a1 8 AnalogIn camData(PTC2);
ericoneill 2:3eb545c3e6a1 9 //Servo, Motor, Serial Pins
ericoneill 2:3eb545c3e6a1 10 PwmOut servo(PTA5);
cheryl_he 10:85f486ad4e5f 11 PwmOut motor1(PTA4);
cheryl_he 10:85f486ad4e5f 12 PwmOut motor2(PTA12);
cheryl_he 10:85f486ad4e5f 13 DigitalOut break1(PTC12);
cheryl_he 10:85f486ad4e5f 14 DigitalOut break2(PTC13);
ericoneill 2:3eb545c3e6a1 15 Serial pc(USBTX, USBRX);
ericoneill 2:3eb545c3e6a1 16 // Interrupt for encoder
ericoneill 2:3eb545c3e6a1 17 InterruptIn interrupt(PTA13);
ericoneill 0:2002d645d2a6 18
ericoneill 12:45e6cb021301 19 float line [128];
ericoneill 12:45e6cb021301 20 Mutex line_mutex;
ericoneill 4:03594bf9a0de 21
ericoneill 4:03594bf9a0de 22 void linecam_thread(void const *args){
ericoneill 13:97708869a4ba 23 while(1){
ericoneill 13:97708869a4ba 24 line_mutex.lock();
ericoneill 13:97708869a4ba 25 pc.printf("[");
ericoneill 13:97708869a4ba 26 for(int i=0; i<128; i++){
ericoneill 13:97708869a4ba 27 pc.printf("%f",line[i]);
ericoneill 13:97708869a4ba 28 pc.printf(" ");
ericoneill 13:97708869a4ba 29 }
ericoneill 13:97708869a4ba 30 pc.printf("]");
ericoneill 13:97708869a4ba 31 }
ericoneill 5:764c2ffb523a 32
ericoneill 4:03594bf9a0de 33 }
ericoneill 4:03594bf9a0de 34
ericoneill 4:03594bf9a0de 35
ericoneill 0:2002d645d2a6 36 int main() {
ericoneill 4:03594bf9a0de 37 Thread thread(linecam_thread);
ericoneill 13:97708869a4ba 38 thread.set_priority(osPriorityIdle);
ericoneill 13:97708869a4ba 39 //thread.set_priority(-3);
ericoneill 12:45e6cb021301 40
ericoneill 0:2002d645d2a6 41 while(1) {
ericoneill 12:45e6cb021301 42
ericoneill 0:2002d645d2a6 43 }
ericoneill 0:2002d645d2a6 44 }