DuckieTownCarHS

Dependencies:   TCS3200 X_NUCLEO_IKS01A2 mbed-rtos mbed

Fork of DuckieTownCar by Domenico Francesco De Angelis

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "rtos.h"
00003 #include "DuckieTownCar.h"
00004 
00005 /*
00006 * Utilizzo il RTOS-MBED! perchè?
00007 * Perchè ho la necessità di avere le info dai sensori senza essere bloccante
00008 */
00009 
00010 DuckieTownCar* car = DuckieTownCar::getInstance();
00011 
00012 Mutex car_mutex; 
00013  
00014 void update_car(void const *args){
00015     car_mutex.lock();
00016     car->updateStateCar();
00017     car_mutex.unlock();
00018 }
00019 
00020 int main(){
00021     Thread th_update(update_car);
00022     car_mutex.lock();
00023     car->initCarSensor();
00024     car_mutex.unlock();
00025     
00026     car->executeRandom();
00027     return 0;    
00028 }