![](/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:
- 8:6e55db96c11c
- Parent:
- 7:a92da438d06c
- Child:
- 9:d86a6b8cdfa4
diff -r a92da438d06c -r 6e55db96c11c CAR.cpp --- a/CAR.cpp Mon Apr 07 17:15:50 2014 +0000 +++ b/CAR.cpp Wed Apr 09 09:41:30 2014 +0000 @@ -128,20 +128,40 @@ void CAR::Side_Light_Flash(void const *args){ while(true){ SWITCH_SEM.wait(); - if(LSide_Indicator_Value == 1){ - L_Side_Light = L_Side_Light ^ 1; + if((LSide_Indicator_Value == 1) && (RSide_Indicator_Value == 1) ){ + L_Side_Indicator = L_Side_Indicator ^ 1; + R_Side_Indicator = L_Side_Indicator; + } + else if(RSide_Indicator_Value == 1){ + R_Side_Indicator = R_Side_Indicator ^ 1; + L_Side_Indicator = 0; + } + else if(LSide_Indicator_Value == 1){ + L_Side_Indicator = L_Side_Indicator ^ 1; + R_Side_Indicator = 0; + } + else{ + L_Side_Indicator = 0; + R_Side_Indicator = 0 ; + } + SWITCH_SEM.release(); + Thread::wait(1000); + } +} +void CAR::Side_Light(void const *args){ + while(true){ + if(LSide_Light_Switch){ + L_Side_Light = 1; } else{ L_Side_Light = 0; } - if(RSide_Indicator_Value == 1){ - R_Side_Light = R_Side_Light ^ 1; - SWITCH_SEM.release(); + if(RSide_Light_Switch){ + R_Side_Light = 1; } else{ - R_Side_Light = 0 ; + R_Side_Light = 0; } - SWITCH_SEM.release(); Thread::wait(1000); } } \ No newline at end of file