Julesnaps / Mbed 2 deprecated Linefollowproject

Dependencies:   m3pi mbed

Revision:
9:7b9094864268
Parent:
8:5640c8c5088e
Child:
11:d13596393d56
Child:
13:ddff4bb7c24f
diff -r 5640c8c5088e -r 7b9094864268 main.cpp
--- a/main.cpp	Thu Oct 06 11:26:16 2022 +0000
+++ b/main.cpp	Thu Oct 06 11:32:01 2022 +0000
@@ -14,7 +14,7 @@
 
 // Prototypes
 int PitTest(void);   // Test if to robot needs to goto pit 
-
+void InitialMessages (void); // Prints initial message to the LCD 
 int main() {
     
     m3pi.sensor_auto_calibrate();
@@ -29,29 +29,14 @@
     float speed = MAX;
 
     /*Team 7 Variabels*/
-    
     int gotoPit = 0; // wether or not the robot is heading to pit. Initialstate false. 
     int ccount; //used to count cycles
     
 
     
     /*Printing secret cat mission*/
-    m3pi.cls();
-    
-    m3pi.locate(0,0);
-    m3pi.printf("eliminate");
-    m3pi.locate(0,1);
-    m3pi.printf("all cats");
-    wait(200.0);
-    
-    m3pi.cls();
-    m3pi.locate(0,0);
-    m3pi.printf("%f.3 ",m3pi.battery());
-    m3pi.locate(0,1);
-    m3pi.printf("%f.3 ",m3pi.pot_voltage());
-    wait(200.0);
-    m3pi.cls();
-
+    InitialMessage();
+ 
 
     
     while (1) {
@@ -99,7 +84,24 @@
     }
 }
 
-
+void InitialMessage(void){
+    /*Prints iniatl secret mission*/
+    
+    m3pi.cls();
+    m3pi.locate(0,0);
+    m3pi.printf("eliminate");
+    m3pi.locate(0,1);
+    m3pi.printf("all cats");
+    wait(200.0);
+    
+    m3pi.cls();
+    m3pi.locate(0,0);
+    m3pi.printf("%f.3 ",m3pi.battery());
+    m3pi.locate(0,1);
+    m3pi.printf("%f.3 ",m3pi.pot_voltage());
+    wait(200.0);
+    m3pi.cls();
+}
 int PitTest(void){
 /* Test the batteri voltage if the robot is not headed for pit */ 
     
@@ -112,8 +114,8 @@
     
     /*Test if the voltage is below the treshold if so turn on go to pit mode*/
     if (m3pi.battery() <= BATVOLTTRESHOLD ()){  
-        result = 1; // set goto pit condition
-        led1 = 1; // turn on Led 1
+        result = 1; // Set goto pit condition
+        led1 = 1; // Turn on Led 1
         m3pi.cls();
         m3pi.locate(0,0);
         m3pi.printf("Going to");