A program which uses twin DC motors and a lidar to drive a robot controlled by a gamepad through an mbed.

Dependencies:   mbed Motor

Test

This is a test of the repository

Revision:
13:1b31916de79e
Parent:
12:4f635df5b368
Child:
14:6f3985a23eeb
diff -r 4f635df5b368 -r 1b31916de79e main.cpp
--- a/main.cpp	Fri Nov 22 00:08:24 2019 +0000
+++ b/main.cpp	Fri Nov 22 18:36:10 2019 +0000
@@ -17,6 +17,7 @@
 
 static XNucleo53L0A1 *board=NULL;
 bool stopMotor = false;
+bool turbo = false;
 
 float getSpeed(char& value) {
 
@@ -41,7 +42,10 @@
 if(mspeed <= 1.0){
     if(abs(mspeed) > 0.2 && !stopMotor || mspeed > .2){
         pc.printf("%0.2f is the motor speed\n\r", mspeed);
+        if(turbo)
         motor->speed(mspeed);
+        if(!turbo)
+        motor->speed(mspeed/1.75);
         }
     else
         motor->speed(0);
@@ -71,7 +75,9 @@
     if(LRABYX == 'R') {
         btMotorUpdate(&rm);
     }
-    
+    if(LRABYX == 'A') {
+        turbo = !turbo;
+        }  
 
 }
 
@@ -102,10 +108,10 @@
         if (status == VL53L0X_ERROR_NONE) {
             pc.printf("%d\n\r",distance);
             
-            if (distance < 250) { // Distance might need to be adjusted
+            if (distance < 300) { // Distance might need to be adjusted
                 stopMotor = true;
                 led = !led;
-                wait(.1);
+                wait(.1);    
                 }
             else{
                 stopMotor = false;