Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MCP23017 Servo WattBob_TextLCD mbed-rtos mbed
Fork of Ass3 by
Diff: main.cpp
- Revision:
- 10:2522e3878e1c
- Parent:
- 9:d86a6b8cdfa4
- Child:
- 11:7f2414ecb7ee
--- a/main.cpp Wed Apr 09 11:05:32 2014 +0000
+++ b/main.cpp Wed Apr 09 11:47:04 2014 +0000
@@ -8,23 +8,26 @@
#include "CAR.h"
int main() {
- //Turn the LCD on and initialize
- Port.write_bit(1,BL_BIT);
- Thread Accelero_Brake_Thread(CAR::Accelero_Brake_Read);
- Thread Average_Speed_Measure_Thread(CAR::Average_Speed_Measure);
- Thread Average_Speed_Show_Thread(CAR::Average_Speed_Show);
- Thread OverSpeed_Thread(CAR::OverSpeed);
- Thread Odo_Show_Indicator_Switch_Read_Thread(CAR::Odo_Show_Indicator_Switch_Read);
- Thread SEND_CAR_VALUES_Thread(CAR::SEND_CAR_VALUES);
- Thread DUMP_CAR_VALUES_Thread(CAR::DUMP_CAR_VALUES_En);
- Thread Side_Light_Flash_Thread(CAR::Side_Light_Flash);
- Thread Side_Light_Thread(CAR::Side_Light);
- while(1){
+ //Initialize an object of class CAR
+ CAR car1;
+ //Define the multy threat function
+ Thread Accelero_Brake_Thread(car1.Accelero_Brake_Read);
+ Thread Average_Speed_Measure_Thread(car1.Average_Speed_Measure);
+ Thread Average_Speed_Show_Thread(car1.Average_Speed_Show);
+ Thread OverSpeed_Thread(car1.OverSpeed);
+ Thread Odo_Show_Indicator_Switch_Read_Thread(car1.Odo_Show_Indicator_Switch_Read);
+ Thread SEND_CAR_VALUES_Thread(car1.SEND_CAR_VALUES);
+ Thread DUMP_CAR_VALUES_Thread(car1.DUMP_CAR_VALUES_En);
+ Thread Side_Light_Flash_Thread(car1.Side_Light_Flash);
+ Thread Side_Light_Thread(car1.Side_Light);
+ //In main threat function to flash the leds on the board
+ // when the speed become over 70 MPH
+ while(true){
if(IsOverSpeed){
OverSpeedLED = 0x6;
- wait(0.2);
+ wait(0.5);
OverSpeedLED = 0x9;
- wait(0.2) ;
+ wait(0.5) ;
}
else{
OverSpeedLED = 0;
