Overzetten

Dependencies:   HIDScope MODSERIAL mbed

Revision:
2:4d593341fd7a
Parent:
1:f6b25b03b8e2
--- a/main.cpp	Mon Oct 01 13:42:56 2018 +0000
+++ b/main.cpp	Tue Oct 02 12:37:47 2018 +0000
@@ -20,9 +20,7 @@
 HIDScope    scope( 2 );
 DigitalOut  led(LED1);
 
-/** Sample function
- * this function samples the emg and sends it to HIDScope
- **/
+
 void sample()
 {
     /* Set the sampled emg values in channel 0 (the first channel) and 1 (the second channel) in the 'HIDScope' instance named 'scope' */
@@ -46,11 +44,10 @@
     
     for(;;)
     {
-        if(Knop1==false) // Motor 1 rotates CW
+        if(Knop1==false) // MOTOR 1 rotates CW
         {
-            float u = 0.8f; //determine useful value, this is not final
-            DirectionPin1 = u > 0.0f; //either true or false
-                                    // True = CW, for False = CW
+            float u = 0.8f; 
+            DirectionPin1 = u > 0.0f; // True = CW, for False = CW
             PwmPin1 = fabs(u);
             PwmPin2 = fabs(0.0); 
         }
@@ -58,24 +55,28 @@
         else if (Knop2==false)// We see that Motor2 keeps rotating if we leave out the "else" statement, somehow the signal leaks
         {
             float u = 0.8f;
-            DirectionPin2 = u < 0.0f;
-            PwmPin1 = fabs(0.0);
-            PwmPin2 = fabs(u);
+            DirectionPin1 = u < 0.0f;
+            PwmPin1 = fabs(u);
+            PwmPin2 = fabs(0.0);
         }
-    
-        else if (Knop3==false)
+        /*
+        else 
+        {
+            float u = 0.0f;
+            PwmPin1 = fabs(u);
+        }
+    */
+        else if (Knop3==false) // MOTOR 2
         {
             float u = 0.8f;
-            DirectionPin1 = u < 0.0f;
-            PwmPin1 = fabs(u);
-            PwmPin2 = fabs(0.0);  
+            DirectionPin2 = u < 0.0f;
+            PwmPin2 = fabs(u); 
         }
         
         else if (Knop4==false)
         {
             float u = 0.8f;
             DirectionPin2 = u > 0.0f;
-            PwmPin1 = fabs(0.0);
             PwmPin2 = fabs(u);
 
         }
@@ -83,7 +84,7 @@
         else
         {  
             float u = 0.0f;
-            PwmPin1 = PwmPin2 = fabs(u);
+            PwmPin2 = fabs(u);
         }
     }
 }
\ No newline at end of file