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 Muaiyd Al-Zandi

Committer:
muaiyd
Date:
Wed May 07 10:25:50 2014 +0000
Revision:
13:e5b22bfbe67b
Parent:
12:8eb2c1cccee6
Final Version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
muaiyd 8:6e55db96c11c 1 /*
muaiyd 13:e5b22bfbe67b 2 By Muaiyd Hameed Mohammed Al-Zandi
muaiyd 13:e5b22bfbe67b 3 *****************************
muaiyd 13:e5b22bfbe67b 4 * MAIN.CPP *
muaiyd 13:e5b22bfbe67b 5 *****************************
muaiyd 9:d86a6b8cdfa4 6 Small software to simulate a car and show the Average speed and the odometer
muaiyd 9:d86a6b8cdfa4 7 on the LCD. Also, it saves the average speed and accelerometer and brake value
muaiyd 13:e5b22bfbe67b 8 in a special queue. This queue is dumped into a file every 20 second.
muaiyd 13:e5b22bfbe67b 9
muaiyd 8:6e55db96c11c 10 */
muaiyd 0:68ce46607848 11 #include "CAR.h"
muaiyd 1:b409ad65466a 12
muaiyd 0:68ce46607848 13 int main() {
muaiyd 10:2522e3878e1c 14 //Initialize an object of class CAR
muaiyd 10:2522e3878e1c 15 CAR car1;
muaiyd 10:2522e3878e1c 16 //Define the multy threat function
muaiyd 12:8eb2c1cccee6 17 Thread Car_Simulation_Thread(car1.Car_Simulation);
muaiyd 10:2522e3878e1c 18 Thread Average_Speed_Measure_Thread(car1.Average_Speed_Measure);
muaiyd 10:2522e3878e1c 19 Thread Average_Speed_Show_Thread(car1.Average_Speed_Show);
muaiyd 10:2522e3878e1c 20 Thread OverSpeed_Thread(car1.OverSpeed);
muaiyd 13:e5b22bfbe67b 21 Thread ODO_Thread(car1.Odo_Show);
muaiyd 10:2522e3878e1c 22 Thread SEND_CAR_VALUES_Thread(car1.SEND_CAR_VALUES);
muaiyd 10:2522e3878e1c 23 Thread DUMP_CAR_VALUES_Thread(car1.DUMP_CAR_VALUES_En);
muaiyd 10:2522e3878e1c 24 Thread Side_Light_Flash_Thread(car1.Side_Light_Flash);
muaiyd 10:2522e3878e1c 25 Thread Side_Light_Thread(car1.Side_Light);
muaiyd 11:7f2414ecb7ee 26
muaiyd 10:2522e3878e1c 27 //In main threat function to flash the leds on the board
muaiyd 10:2522e3878e1c 28 // when the speed become over 70 MPH
muaiyd 10:2522e3878e1c 29 while(true){
muaiyd 1:b409ad65466a 30 if(IsOverSpeed){
muaiyd 1:b409ad65466a 31 OverSpeedLED = 0x6;
muaiyd 10:2522e3878e1c 32 wait(0.5);
muaiyd 1:b409ad65466a 33 OverSpeedLED = 0x9;
muaiyd 10:2522e3878e1c 34 wait(0.5) ;
muaiyd 1:b409ad65466a 35 }
muaiyd 1:b409ad65466a 36 else{
muaiyd 1:b409ad65466a 37 OverSpeedLED = 0;
muaiyd 1:b409ad65466a 38 }
muaiyd 0:68ce46607848 39 }
muaiyd 0:68ce46607848 40 }