self-balancing-robot

Dependencies:   mbed mbed-rtos Motor

Revision:
25:154c74800ade
Parent:
23:d2dcd3f9c309
Child:
26:dcf173d2904f
--- a/main.cpp	Thu Apr 23 16:18:05 2020 +0000
+++ b/main.cpp	Thu Apr 23 16:42:44 2020 +0000
@@ -120,6 +120,17 @@
     }
 }
 
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////// update motor speeds///////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+void set_wheel_speed(float speed) {
+    if(speed > 1) speed = 1;
+    if (speed < -1) speed = -1;
+    leftWheel = speed;
+    rightWheel = speed;
+}
+
+
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////// Control System Updates///////////////////////////
@@ -128,6 +139,7 @@
 void update_system() {
     while(1){
         get_current_angle();
+        
         //pc.printf("this is running 100");
         Thread::wait(10);
     }