![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
This is car control simulation by using Mbed controller and real time operating system.
Dependencies: MCP23017 Servo WattBob_TextLCD mbed-rtos mbed
Fork of Ass3 by
Diff: CAR.cpp
- Revision:
- 4:952a2d814fb1
- Parent:
- 1:b409ad65466a
- Child:
- 5:c20ab22e8431
diff -r b409ad65466a -r 952a2d814fb1 CAR.cpp --- a/CAR.cpp Mon Apr 07 15:19:37 2014 +0000 +++ b/CAR.cpp Mon Apr 07 15:47:10 2014 +0000 @@ -1,20 +1,12 @@ #include "CAR.h" Semaphore CAR_MAIL_SEM(1); -uint32_t Element_Counter_W = 0; -uint32_t Element_Counter_R = 0; -typedef struct { - uint8_t Mail_Average_Speed; - float Mail_Accelerometer_Value; - float Mail_Brake_Value; - int Counter; - } CAR_MAIL; -static Mail<CAR_MAIL, 100> mail_box; + CAR::CAR(){ Port.write_bit(1,BL_BIT); - - + Element_Counter_W = 0; + Element_Counter_R = 0; } void CAR::SAVE_ODO(float value) { LPC_RTC->GPREG0 = *((uint32_t*)&value); @@ -90,7 +82,7 @@ mail_box.put(mail); printf("\n %i £ \n\r",Element_Counter_W); Element_Counter_W++; - Thread::wait(1000); + Thread::wait(5000); CAR_MAIL_SEM.release(); } } @@ -101,7 +93,7 @@ while (Element_Counter_W > Element_Counter_R) DUMP_CAR_VALUES(); CAR_MAIL_SEM.release(); - Thread::wait(5000); + Thread::wait(20000); } } void CAR::DUMP_CAR_VALUES () {