Julesnaps / Mbed 2 deprecated Linefollowproject

Dependencies:   m3pi mbed

Revision:
75:b3a43f70e44c
Parent:
73:0646bad028c5
Child:
76:4a6286ff0aee
--- a/main.cpp	Tue Oct 25 08:06:57 2022 +0000
+++ b/main.cpp	Tue Oct 25 08:40:14 2022 +0000
@@ -27,9 +27,9 @@
 #define VOLTAGELOGPATH "/local/voltage.txt"
 
 // Prototypes
-
 void LED_Control(int ledNumber, int state); //Turn ledNumber to 1=on, 0 = off
 void LED_Blink(int ledNumber); // Make ledNumber blinik
+
 void LCD_CountDown(int num);  //LCD Coundown function
 void LCD_InitialMessages(void); // Prints initial message to the LCD 
 
@@ -42,6 +42,7 @@
 void TE_CreateVoltageLog(void); //
 void TE_LogVoltage(int count); // test funktion that write the woltage each time the battry is checked
 
+
 int main() {
     LocalFileSystem local("local"); 
     
@@ -60,7 +61,6 @@
     
     /*Printing secret cat mission*/
     LCD_InitialMessages();
-    
     m3pi.sensor_auto_calibrate();
     
 
@@ -228,11 +228,11 @@
         led4 = state;
     }
 }
+
 /**
  * LED_Blink - Make a LED blink
  *@ledNumber - The number of the targeted LED 
  */
-
 void LED_Blink(int ledNumber)
 {
     int a = 2;
@@ -247,7 +247,6 @@
 /**
  * PS_PitStop - Stops the robot and starts the signal
  */
-
 void PS_PitStop(void)
 {
     m3pi.stop();       // stop all engine
@@ -274,10 +273,11 @@
     
 }
 
+/**
+ * PS_AddStopToLog - Add one to the number in the pitstop log 
+ */
 void PS_AddStopToLog(void){
-    /*Opens the pit log and read the number.
-     * Then adds one to that number at write it into the pitlog */
-
+ 
     FILE *fptr;
     int x, y;
     if ((fptr = fopen(PITLOGPATH,"r")) == NULL){
@@ -301,9 +301,12 @@
     fclose(fptr);
 }
 
-
+/** PS_GetNumberofPS - Return the  number i the pitstop recorded in the logfile
+*
+*return: An interger from the the pitlog
+*/
 int PS_GetNumberofPS(void){
-    // Display the number i the pitstop recorded in the logfile
+    // 
     FILE *fptr;
     int x;
     if ((fptr = fopen(PITLOGPATH,"r")) == NULL){
@@ -317,7 +320,8 @@
      return x;
 }
 
-
+/** TE_CreateVoltageLog - create a voltagelog
+*/
 void TE_CreateVoltageLog(void){
 /* Create a voltagelog file and test if it can open*/
     FILE *fptr;
@@ -331,13 +335,15 @@
     
     fclose(fptr);
 }
-
+/** TE_LogVoltage - Add an entry to the voltagelog 
+*@count: The number the counter has reached in the main loop 
+*/
 void TE_LogVoltage(int count){
-/* Create a pitlog file and test if it can open*/
+
     FILE *fptr; /* voltagelog adres */
     fptr = fopen(VOLTAGELOGPATH,"a");
   
-    fprintf(fptr," %8d      %4.4f      %4.4f \n"  ,count, m3pi.battery(),m3pi.pot_voltage()  );
+    fprintf(fptr," %8d   ,   %4.4f   ,   %4.4f \n"  ,count, m3pi.battery(),m3pi.pot_voltage()  );
     fclose(fptr);
 
 }
\ No newline at end of file