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@12:8eb2c1cccee6, 2014-05-06 (annotated)
- Committer:
- muaiyd
- Date:
- Tue May 06 09:49:08 2014 +0000
- Revision:
- 12:8eb2c1cccee6
- Parent:
- 11:7f2414ecb7ee
- Child:
- 13:e5b22bfbe67b
Make all input in the Simulation Task
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 | 12:8eb2c1cccee6 | 14 | Thread Car_Simulation_Thread(car1.Car_Simulation); |
muaiyd | 12:8eb2c1cccee6 | 15 | |
muaiyd | 10:2522e3878e1c | 16 | Thread Average_Speed_Measure_Thread(car1.Average_Speed_Measure); |
muaiyd | 10:2522e3878e1c | 17 | Thread Average_Speed_Show_Thread(car1.Average_Speed_Show); |
muaiyd | 10:2522e3878e1c | 18 | Thread OverSpeed_Thread(car1.OverSpeed); |
muaiyd | 11:7f2414ecb7ee | 19 | Thread ODO_And_Indicator_Switch_Read_Thread(car1.Odo_Show_Indicator_Switch_Read); |
muaiyd | 10:2522e3878e1c | 20 | Thread SEND_CAR_VALUES_Thread(car1.SEND_CAR_VALUES); |
muaiyd | 10:2522e3878e1c | 21 | Thread DUMP_CAR_VALUES_Thread(car1.DUMP_CAR_VALUES_En); |
muaiyd | 12:8eb2c1cccee6 | 22 | |
muaiyd | 10:2522e3878e1c | 23 | Thread Side_Light_Flash_Thread(car1.Side_Light_Flash); |
muaiyd | 10:2522e3878e1c | 24 | Thread Side_Light_Thread(car1.Side_Light); |
muaiyd | 11:7f2414ecb7ee | 25 | |
muaiyd | 10:2522e3878e1c | 26 | //In main threat function to flash the leds on the board |
muaiyd | 10:2522e3878e1c | 27 | // when the speed become over 70 MPH |
muaiyd | 10:2522e3878e1c | 28 | while(true){ |
muaiyd | 1:b409ad65466a | 29 | if(IsOverSpeed){ |
muaiyd | 1:b409ad65466a | 30 | OverSpeedLED = 0x6; |
muaiyd | 10:2522e3878e1c | 31 | wait(0.5); |
muaiyd | 1:b409ad65466a | 32 | OverSpeedLED = 0x9; |
muaiyd | 10:2522e3878e1c | 33 | wait(0.5) ; |
muaiyd | 1:b409ad65466a | 34 | } |
muaiyd | 1:b409ad65466a | 35 | else{ |
muaiyd | 1:b409ad65466a | 36 | OverSpeedLED = 0; |
muaiyd | 1:b409ad65466a | 37 | } |
muaiyd | 0:68ce46607848 | 38 | } |
muaiyd | 0:68ce46607848 | 39 | } |