Julesnaps / Mbed 2 deprecated Linefollowproject

Dependencies:   m3pi mbed

Revision:
87:88aebb4c7226
Parent:
86:ca4ecb8828ed
Child:
88:55cd0d863d4f
--- a/main.cpp	Tue Oct 25 09:48:58 2022 +0000
+++ b/main.cpp	Tue Oct 25 10:05:16 2022 +0000
@@ -29,7 +29,6 @@
 #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
@@ -205,7 +204,7 @@
     /*Test if the voltage is below the threshold if so turn on go to pit mode*/
     if (m3pi.battery() <= BATVOLTTRESHOLD ){  
         result = 1; // Set goto pit condition
-        LED_Control(1, 1);
+        LED_Blink(3);
 
         m3pi.cls();
         m3pi.locate(0,0);
@@ -223,12 +222,52 @@
 void LED_Blink(int ledNumber)
 {
     int a = 2;
-    LED_Control (ledNumber , 0);
-    wait(a);
-    LED_Control (ledNumber , 1);
-    wait(a);
-    LED_Control (ledNumber , 0);
-    wait(a);
+    
+    switch (ledNumber){
+        case(1):
+            led1 = 0;
+            wait(a);
+            led1 = 1;
+            wait(a);
+            led1 = 0;
+            wait(a);
+            break;
+        
+        case(2):
+    
+            led2 = 0;
+            wait(a);
+            led2 = 1;
+            wait(a);
+            led2 = 0;
+            wait(a);
+            break;
+        
+        case(3):
+            led3 = 0;
+            wait(a);
+            led3 = 1;
+            wait(a);
+            led3 = 0;
+            wait(a);
+            break;
+
+        case(4):
+            led4 = 0;
+            wait(a);
+            led4 = 1;
+            wait(a);
+            led4 = 0;
+            wait(a);
+            break;
+        
+        
+        default:
+            break;
+    }
+
+
+        
     }
 
 /**