aangepaste PID waarden, waarden robert gedeeld door 5

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed

Fork of Motor_EMG_FinalV1 by BMT M9 groep 7

Revision:
8:86a13efe98c8
Parent:
7:111e13da9bc0
--- a/main.cpp	Wed Oct 28 11:02:42 2015 +0000
+++ b/main.cpp	Thu Oct 29 12:12:28 2015 +0000
@@ -350,44 +350,44 @@
                 LedG = LedB = 1;
                 LedR = 0;
                 //Linker grenzen
-                if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1) && (m2_ref > 0)) // if(c == 't') //
+                if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1) && (m2_ref < 0)) // if(c == 't') // Draait naar links
                 {
                     m1_ref = m1_ref + Stapgrootte;
                     
-                    if (m1_ref > -1*m2_ref + 80 )
+                    if (m1_ref < -1*m2_ref + 80 )
                     {
-                        m1_ref = -1*m2_ref + 80;
+                        m1_ref = -1*m2_ref + 80 ;
                     }
                     wait(0.05);
                 }
-                if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3) && (m2_ref > 0)) //if(c == 'g') //
+                if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3) && (m2_ref < 0)) //if(c == 'g') // Draait naar rechts
                 {
                     m1_ref = m1_ref - Stapgrootte;
                   
-                    if (m1_ref < -1*Grens1)
+                    if (m1_ref > Grens1 )
                     {
-                        m1_ref = -1*Grens1;
+                        m1_ref = Grens1;
                     }
                     wait(0.05);
                 }
                 //Rechter grenzen
-                if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1) && (m2_ref <= 0)) // if(c == 't') //
-                {
+                if ((EMG_right_MAF <= Threshold3) && (EMG_left_MAF >= Threshold1) && (m2_ref >= 0)) // if(c == 't') // Draait naar links
+                {   
                     m1_ref = m1_ref + Stapgrootte;
                     
-                    if (m1_ref > -1*m2_ref - 80 )
+                    if (m1_ref > Grens1 )
                     {
-                        m1_ref = -1*m2_ref - 80;
+                        m1_ref = Grens1;
                     }
                     wait(0.05);
                 }
-                if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3) && (m2_ref <= 0)) //if(c == 'g') //
-                {
+                if ((EMG_left_MAF < Threshold1) && (EMG_right_MAF > Threshold3) && (m2_ref >= 0)) //if(c == 'g') // Draait naar rechts
+                {   
                     m1_ref = m1_ref - Stapgrootte;
                   
-                    if (m1_ref < -1*Grens1)
+                    if (m1_ref < -1*m2_ref + 80 )
                     {
-                        m1_ref = -1*Grens1;
+                        m1_ref = -1*m2_ref + 80 ;
                     }
                     wait(0.05);
                 }