Lars van der Hoeven / Mbed 2 deprecated motorshield_01

Dependencies:   MODSERIAL mbed HIDScope

Revision:
1:f75a3567978c
Parent:
0:80f93308a3cd
Child:
2:fa2cc8d8e100
--- a/main.cpp	Mon Oct 15 13:17:29 2018 +0000
+++ b/main.cpp	Wed Oct 17 08:12:59 2018 +0000
@@ -14,39 +14,29 @@
 float y = 0;
 int main()
 {
-Motor1PWR.period_us(60);
-while(1){
-    if(Pot1<0.45f)
-    {
-        x = Pot1-1;
-    }
-    else if(Pot1>0.55f)
-    {
-        x = Pot1;
-    }
-    else
-    {
-        x = 0;   
+    Motor1PWR.period_us(60);
+    while(1) {
+        if(Pot1<0.45f) {
+            x = Pot1-1;
+        } else if(Pot1>0.55f) {
+            x = Pot1;
+        } else {
+            x = 0;
+        }
+
+        if(Pot2<0.45f) {
+            y = Pot2-1;
+        } else if(Pot2>0.55f) {
+            y = Pot2;
+        } else {
+            y = 0;
+        }
+        pc.printf("x = %f, y = %f\r\n",x,y);
+        Motor1PWR = fabs(y);
+        Motor1DIR = y > 0.0f;
+        Motor2PWR = fabs(x);
+        Motor2DIR = x > 0.0f;
+        wait(0.1f);
     }
-    
-    if(Pot2<0.45f)
-    {
-        y = Pot2-1;
-    }
-    else if(Pot2>0.55f)
-    {
-        y = Pot2;
-    }
-    else
-    {
-        y = 0;   
-    }
-    pc.printf("x = %f, y = %f\r\n",x,y);
-    Motor1PWR = fabs(y);
-    Motor1DIR = y > 0.0f;
-    Motor2PWR = fabs(x);
-    Motor2DIR = x > 0.0f;
-    wait(0.1f);
-    }
-return(0);
+    return(0);
 }
\ No newline at end of file