first commit

Dependencies:   mbed MMA8451Q

Revision:
26:54ce9f642477
Parent:
25:8bd029d58251
Child:
28:1c2eb25d624e
--- a/driving.h	Sat Nov 06 16:31:02 2021 +0000
+++ b/driving.h	Mon Nov 08 21:08:41 2021 +0000
@@ -75,7 +75,9 @@
      errorAreaLeft = 0.0;
      
     };
-
+void _steering(void){
+    
+    }
 
 /* 
     Always set duty cycle to zero (disabling the motor), unless the motor is enabled 
@@ -89,28 +91,30 @@
 speedLeftVolt = (speedSensorLeft.read() * 3.3f);
 speedRightVolt = (speedSensorRight.read() * 3.3f);
 
-     
+                
+     //_steering();
+
     if(motor_enabled == true) {
        if(counter == 0 && lap == 0 )
        {
-           setpointLeft = 0.12;
-           setpointRight = 0.12;
+           setpointLeft = 0.1;
+           setpointRight = 0.1;
            }
         else if(counter == 0 && lap == 2 )
         {
-            setpointLeft = 0.17;
-            setpointRight = 0.17;
+            setpointLeft = 0.1;
+            setpointRight = 0.1;
         }
         else if(counter !=0 && lap == 2 )
         {
-            setpointLeft = 0.14;
-           setpointRight = 0.14;
+            setpointLeft = 0.1;
+           setpointRight = 0.1;
             
             }
         else 
         {
-        setpointLeft = 0.11;
-        setpointRight = 0.11;    
+        setpointLeft = 0.1;
+        setpointRight = 0.1;    
         }
        //  setpointLeft = 0.1;
     //     setpointRight = 0.1;
@@ -133,6 +137,7 @@
         }
         errorAreaLeftPrev = errorAreaLeft;
         errorAreaRightPrev = errorAreaRight;
+ 
             /*
             if (errorAreaLeft > 0.1){
                errorAreaLeft = 0.0;
@@ -182,6 +187,7 @@
                     clampRight = false;
             }
             
+            
                
             //--- set motors to calculated output ---    
             motorLeft.write(dutyCycleLeft); // 0.2 For debugging