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:
Tue May 06 09:11:01 2014 +0000
Revision:
11:7f2414ecb7ee
Parent:
10:2522e3878e1c
Child:
12:8eb2c1cccee6
Last change; Optemization

Who changed what in which revision?

UserRevisionLine numberNew 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 11:7f2414ecb7ee 14 Thread Accelero_Brake__Read_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 11:7f2414ecb7ee 18 Thread ODO_And_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 11:7f2414ecb7ee 23
muaiyd 10:2522e3878e1c 24 //In main threat function to flash the leds on the board
muaiyd 10:2522e3878e1c 25 // when the speed become over 70 MPH
muaiyd 10:2522e3878e1c 26 while(true){
muaiyd 1:b409ad65466a 27 if(IsOverSpeed){
muaiyd 1:b409ad65466a 28 OverSpeedLED = 0x6;
muaiyd 10:2522e3878e1c 29 wait(0.5);
muaiyd 1:b409ad65466a 30 OverSpeedLED = 0x9;
muaiyd 10:2522e3878e1c 31 wait(0.5) ;
muaiyd 1:b409ad65466a 32 }
muaiyd 1:b409ad65466a 33 else{
muaiyd 1:b409ad65466a 34 OverSpeedLED = 0;
muaiyd 1:b409ad65466a 35 }
muaiyd 0:68ce46607848 36 }
muaiyd 0:68ce46607848 37 }