Code for the car to drive in a figure eight motion

Dependencies:   mbed-rtos mbed MODSERIAL mbed-dsp telemetry

main.cpp

Committer:
ericoneill
Date:
2015-03-20
Revision:
13:97708869a4ba
Parent:
12:45e6cb021301
Child:
14:09d61b20b102
Child:
16:fa13ac00f583

File content as of revision 13:97708869a4ba:

#include "mbed.h"
#include "rtos.h"

// Camera Pins
DigitalOut clk(PTA13);
DigitalOut si(PTD4);
AnalogIn camData(PTC2);
//Servo, Motor, Serial Pins
PwmOut servo(PTA5);
PwmOut motor1(PTA4);
PwmOut motor2(PTA12);
DigitalOut break1(PTC12);
DigitalOut break2(PTC13);
Serial pc(USBTX, USBRX);
// Interrupt for encoder
InterruptIn interrupt(PTA13);

float line [128];
Mutex line_mutex;

void linecam_thread(void const *args){
    while(1){
        line_mutex.lock();
        pc.printf("[");
        for(int i=0; i<128; i++){
            pc.printf("%f",line[i]);
            pc.printf(" ");
        }
        pc.printf("]");
    }
    
}


int main() {
    Thread thread(linecam_thread);
    thread.set_priority(osPriorityIdle);
    //thread.set_priority(-3);
    
    while(1) {
        
    }
}