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
main.cpp@9:d86a6b8cdfa4, 2014-04-09 (annotated)
- Committer:
- muaiyd
- Date:
- Wed Apr 09 11:05:32 2014 +0000
- Revision:
- 9:d86a6b8cdfa4
- Parent:
- 8:6e55db96c11c
- Child:
- 10:2522e3878e1c
Optimization and comment;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
muaiyd | 8:6e55db96c11c | 1 | /* |
muaiyd | 9:d86a6b8cdfa4 | 2 | Small software to simulate a car and show the Average speed and the odometer |
muaiyd | 9:d86a6b8cdfa4 | 3 | on the LCD. Also, it saves the average speed and accelerometer and brake value |
muaiyd | 9:d86a6b8cdfa4 | 4 | in a special queue. This queue is sumped into a file every 20 second. |
muaiyd | 9:d86a6b8cdfa4 | 5 | Author : Muaiyd Hameed Al-Zandi |
muaiyd | 9:d86a6b8cdfa4 | 6 | Date : 09/04/2014 |
muaiyd | 8:6e55db96c11c | 7 | */ |
muaiyd | 0:68ce46607848 | 8 | #include "CAR.h" |
muaiyd | 1:b409ad65466a | 9 | |
muaiyd | 0:68ce46607848 | 10 | int main() { |
muaiyd | 9:d86a6b8cdfa4 | 11 | //Turn the LCD on and initialize |
muaiyd | 0:68ce46607848 | 12 | Port.write_bit(1,BL_BIT); |
muaiyd | 9:d86a6b8cdfa4 | 13 | Thread Accelero_Brake_Thread(CAR::Accelero_Brake_Read); |
muaiyd | 9:d86a6b8cdfa4 | 14 | Thread Average_Speed_Measure_Thread(CAR::Average_Speed_Measure); |
muaiyd | 9:d86a6b8cdfa4 | 15 | Thread Average_Speed_Show_Thread(CAR::Average_Speed_Show); |
muaiyd | 9:d86a6b8cdfa4 | 16 | Thread OverSpeed_Thread(CAR::OverSpeed); |
muaiyd | 9:d86a6b8cdfa4 | 17 | Thread Odo_Show_Indicator_Switch_Read_Thread(CAR::Odo_Show_Indicator_Switch_Read); |
muaiyd | 9:d86a6b8cdfa4 | 18 | Thread SEND_CAR_VALUES_Thread(CAR::SEND_CAR_VALUES); |
muaiyd | 9:d86a6b8cdfa4 | 19 | Thread DUMP_CAR_VALUES_Thread(CAR::DUMP_CAR_VALUES_En); |
muaiyd | 9:d86a6b8cdfa4 | 20 | Thread Side_Light_Flash_Thread(CAR::Side_Light_Flash); |
muaiyd | 9:d86a6b8cdfa4 | 21 | Thread Side_Light_Thread(CAR::Side_Light); |
muaiyd | 1:b409ad65466a | 22 | while(1){ |
muaiyd | 1:b409ad65466a | 23 | if(IsOverSpeed){ |
muaiyd | 1:b409ad65466a | 24 | OverSpeedLED = 0x6; |
muaiyd | 1:b409ad65466a | 25 | wait(0.2); |
muaiyd | 1:b409ad65466a | 26 | OverSpeedLED = 0x9; |
muaiyd | 1:b409ad65466a | 27 | wait(0.2) ; |
muaiyd | 1:b409ad65466a | 28 | } |
muaiyd | 1:b409ad65466a | 29 | else{ |
muaiyd | 1:b409ad65466a | 30 | OverSpeedLED = 0; |
muaiyd | 1:b409ad65466a | 31 | } |
muaiyd | 0:68ce46607848 | 32 | } |
muaiyd | 0:68ce46607848 | 33 | } |