Ramon Waninge / Mbed 2 deprecated Milestone1

Dependencies:   FastPWM mbed QEI biquadFilter HIDScope MODSERIAL

Revision:
7:7c005b3cf288
Parent:
6:3c9569087274
Child:
8:4f15670bc00b
--- a/main.cpp	Mon Oct 08 08:16:05 2018 +0000
+++ b/main.cpp	Mon Oct 08 08:31:30 2018 +0000
@@ -1,10 +1,8 @@
 #include "mbed.h"
 #include "FastPWM.h"
 
-
 Ticker motor;
 
-
 AnalogIn pot1(A1);
 AnalogIn pot2(A2);
 FastPWM pin5(D5);       // Motor 2 pwm
@@ -14,32 +12,21 @@
 //float u1  = pot1;
 
 void draai(){
-    float u1 = 2.0*(pot1 - 0.5);
-    if (u1>0)
-    {   pin4 = true;
-    }
-    else if(u1<0)
-    {   pin4 = false;    
-    }
-    pin5 = fabs(u1);
+    float u1 = 2.0*(pot1 - 0.5);    // Potmeter 1 connects to motor 1
+    u1>0;                         // Determines direction of motor 1
+    pin5 = fabs(u1);                // Determines pwm of motor 1
     
-    float u2 = 2.0*(pot2 - 0.5);
-    if (u2>0)
-    {   pin7 = true;
-    }
-    else if(u2<0)
-    {   pin7 = false;    
-    }
-    pin6 = fabs(u2);     
+    float u2 = 2.0*(pot2 - 0.5);    // Potmeter 2 connects to motor 2
+    u2>0;                         // Determines direction of motor 2
+    pin6 = fabs(u2);                // Determines pwm of motor 2
 }
 int main(){
-   
     pin5.period_us(50);
     motor.attach(draai, 0.001);
-    
     pin6.period_us(50);
     motor.attach(draai, 0.001);
-   while(true){
-       
+    while(true)
+    {
+      
     }
 }
\ No newline at end of file