kalibratie emg, motors worden soortvan aangestuurd met emg gaat nog niet gecontroleerd

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

Revision:
5:a53081a119c0
Parent:
3:9b8d3180fe48
--- a/emgmeting.cpp	Thu Oct 31 21:20:42 2019 +0000
+++ b/emgmeting.cpp	Thu Oct 31 22:17:15 2019 +0000
@@ -241,39 +241,32 @@
             emgRT_max = emgRTfiltered;
         }
         //pc.printf("emgRT_max = %f \r\n", emgRT_max);
-        led5=0; //led gaat aan zodra je rechterbeenspier moet aanspannen
-    } else if (tijd > 18000) {
-        
-        //pc.printf("Calibration finished!");
+        led5=0; //led gaat aan zodra je rechtertricep moet aanspannen
     } else {
         led5=1; //led gaat uit zodra kalibratie voltooid
     }
     tijd= tijd + 1;    //idealiter op een andere plek haha
     
-threshold_emgLB = threshold*emgLB_max;   //bepaal threshold, nu op 0.15*maximale waarde. 
+threshold_emgLB = threshold*emgLB_max;   
 threshold_emgRB = threshold*emgRB_max; 
 threshold_emgRT = threshold*emgRT_max;
 
-
 // if threshold_emgx is reached, brushingmodes activated
 }
 
-  
-
 void brushingmode()
 {
     
 //boven draait arm 1 aan, dus motor 1 
 //onder draait arm 2 aan, dus motor 2 
 if (emgLBfiltered > threshold_emgLB){      //tandenborstel naar links (cw/ccw) //direction1/2 = cw/ccw
-
 motor2_direction.write(direction1);   //motor 2 gaat cw
 //motor2_direction.write(direction1 = !direction1); //is counterclockwise
 motor2_pwm.write(maxPWM2);
 
 }else if (emgRBfiltered > threshold_emgRB){
-    motor2_pwm.write(maxPWM2);
-    motor2_direction.write(direction1 = !direction1); //is counterclockwise
+motor2_direction.write(direction1 = !direction1); //is counterclockwise
+motor2_pwm.write(maxPWM2);
 //tandenborstel naar rechts
 
 }else if (emgRTfiltered > threshold_emgRT){