![](/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
main.cpp@10:2522e3878e1c, 2014-04-09 (annotated)
- Committer:
- muaiyd
- Date:
- Wed Apr 09 11:47:04 2014 +0000
- Revision:
- 10:2522e3878e1c
- Parent:
- 9:d86a6b8cdfa4
- Child:
- 11:7f2414ecb7ee
Return to this point
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 | 10:2522e3878e1c | 11 | //Initialize an object of class CAR |
muaiyd | 10:2522e3878e1c | 12 | CAR car1; |
muaiyd | 10:2522e3878e1c | 13 | //Define the multy threat function |
muaiyd | 10:2522e3878e1c | 14 | Thread Accelero_Brake_Thread(car1.Accelero_Brake_Read); |
muaiyd | 10:2522e3878e1c | 15 | Thread Average_Speed_Measure_Thread(car1.Average_Speed_Measure); |
muaiyd | 10:2522e3878e1c | 16 | Thread Average_Speed_Show_Thread(car1.Average_Speed_Show); |
muaiyd | 10:2522e3878e1c | 17 | Thread OverSpeed_Thread(car1.OverSpeed); |
muaiyd | 10:2522e3878e1c | 18 | Thread Odo_Show_Indicator_Switch_Read_Thread(car1.Odo_Show_Indicator_Switch_Read); |
muaiyd | 10:2522e3878e1c | 19 | Thread SEND_CAR_VALUES_Thread(car1.SEND_CAR_VALUES); |
muaiyd | 10:2522e3878e1c | 20 | Thread DUMP_CAR_VALUES_Thread(car1.DUMP_CAR_VALUES_En); |
muaiyd | 10:2522e3878e1c | 21 | Thread Side_Light_Flash_Thread(car1.Side_Light_Flash); |
muaiyd | 10:2522e3878e1c | 22 | Thread Side_Light_Thread(car1.Side_Light); |
muaiyd | 10:2522e3878e1c | 23 | //In main threat function to flash the leds on the board |
muaiyd | 10:2522e3878e1c | 24 | // when the speed become over 70 MPH |
muaiyd | 10:2522e3878e1c | 25 | while(true){ |
muaiyd | 1:b409ad65466a | 26 | if(IsOverSpeed){ |
muaiyd | 1:b409ad65466a | 27 | OverSpeedLED = 0x6; |
muaiyd | 10:2522e3878e1c | 28 | wait(0.5); |
muaiyd | 1:b409ad65466a | 29 | OverSpeedLED = 0x9; |
muaiyd | 10:2522e3878e1c | 30 | wait(0.5) ; |
muaiyd | 1:b409ad65466a | 31 | } |
muaiyd | 1:b409ad65466a | 32 | else{ |
muaiyd | 1:b409ad65466a | 33 | OverSpeedLED = 0; |
muaiyd | 1:b409ad65466a | 34 | } |
muaiyd | 0:68ce46607848 | 35 | } |
muaiyd | 0:68ce46607848 | 36 | } |