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.
Diff: main.cpp
- Branch:
- Uld minor fixes
- Revision:
- 53:cef682f8684b
- Parent:
- 48:dc6ac1715e31
- Child:
- 54:c4f02c75ba8d
- Child:
- 56:ea9a5cfbcc6b
--- a/main.cpp Wed Oct 12 07:49:56 2022 +0000 +++ b/main.cpp Wed Oct 12 09:27:42 2022 +0000 @@ -30,12 +30,14 @@ #define VOLTAGELOGPATH "/local/voltage.txt" // Prototypes -int PitTest(void); // Test if to robot needs to goto pit -void InitialMessages(void); // Prints initial message to the LCD + + void LED_Control(int ledNumber, int state); //Turn ledNumber to 1=on, 0 = off void LED_Blink(int ledNumber); // Make ledNumber blinik -void LCDCountDown(int num); //LCD Coundown function +void LCD_CountDown(int num); //LCD Coundown function +void LCD_InitialMessages(void); // Prints initial message to the LCD +int PS_BatteryTest(void); // Test if to robot needs to goto pit void PS_PitStop(void); // void PS_CreateLog(void); // create a log file or resets it (WIP void PS_AddStopToLog(void); // Add one to the log @@ -61,10 +63,9 @@ int ccount = 0; //used to count cycles /*Printing secret cat mission*/ - InitialMessages(); + LCD_InitialMessages(); m3pi.sensor_auto_calibrate(); - /*Create pitlog used to log the number of pitstop */ PS_CreateLog(); TE_CreateVoltageLog(); @@ -74,7 +75,7 @@ if (ccount % CYCLEBEFORETEST == 0 && gotoPit == 0) { TE_LogVoltage(ccount); - gotoPit = PitTest(); + gotoPit = PS_BatteryTest(); } if (gotoPit == 1) { @@ -125,7 +126,7 @@ } -void InitialMessages(void){ +void LCD_InitialMessages(void){ /*Prints iniatl secret mission*/ m3pi.cls(); @@ -147,13 +148,14 @@ m3pi.locate(0,1); m3pi.printf("TRACK!!"); wait(4.0); - LCDCountDown(3); + LCD_CountDown(3); m3pi.cls(); m3pi.locate(0,0); m3pi.printf("** GO **"); + wait (1.0); } -void LCDCountDown(int num){ +void LCD_CountDown(int num){ for (int i=0; i<num; i++) { m3pi.cls(); @@ -164,10 +166,10 @@ } -int PitTest(void){ +int PS_BatteryTest(void){ /* Test the batteri voltage if the robot is not headed for pit */ - const float BATVOLTTRESHOLD = 0.05; // Treshold i volt + const float BATVOLTTRESHOLD = 0.5; // Treshold i volt int result = 0; /*Test if the voltage is below the threshold if so turn on go to pit mode*/ @@ -305,15 +307,3 @@ fprintf(fptr," %8d %4.4f %4.4f \n" ,count, m3pi.battery(),m3pi.pot_voltage() ); fclose(fptr); } - -// Julesnaps smager godt og Andreas skal drikke hvergang en anden drikker - -// Det bliver hårdt :) -// Ingen sang - tak. - - - - -gnjask lfdajklf hasj klhdfjkl asdf -asd fasdf sda -a sdfa sdf daf da \ No newline at end of file