Railway Challenge / Mbed OS Railway Challenge 2022-23

Dependencies:   millis

Revision:
36:af4fb5f4988a
Parent:
35:2f476d981896
Child:
39:2438bf7f2590
--- a/main.cpp	Wed Jun 22 11:14:32 2022 +0000
+++ b/main.cpp	Fri Jun 24 09:34:37 2022 +0000
@@ -59,6 +59,8 @@
 }
 //Motor code
 void speedControl(int commandedSpeed) {
+  if (dashboard.currentSpeed<16.00)
+  {
   switch (commandedSpeed) {
 
     default:
@@ -108,6 +110,14 @@
       motor1.throttle(1.0f);
       break;
   }
+  }
+  else {  // IF OVER 15KPH
+        if (dashboard.currentSpeed < 20.00) {   // If speed less than 20 (we cant physically go this fast so any faster is probably compressor noise), cut throttle, otherwise ignore
+            motor1.throttle(0.0f);    // COMMENTED AS ALREADY SET 0 IN BRAKECONTROL
+//          //brakeControl(1);
+        }
+        }
+  
 }
 ///Energy Storage
 //energy storage display code