This is with minumum of 10 milliseconds threshold delay 00:53

Dependencies:   biquadFilter MODSERIAL QEI Servo mbed

Fork of StateMachine_EMg_RKI_PID_MOTOR_metklikenalles by Gaston Gabriël

Revision:
3:3a9fdac2ba69
Parent:
2:0a8622662f6d
Child:
4:c7be673eb4a1
diff -r 0a8622662f6d -r 3a9fdac2ba69 main.cpp
--- a/main.cpp	Thu Nov 01 08:10:21 2018 +0000
+++ b/main.cpp	Thu Nov 01 08:46:04 2018 +0000
@@ -84,7 +84,7 @@
     volatile double temp_highest_emg4 = 0;
     
     //Doubles for calculation threshold
-    double p_t;
+    double p_t; //set threshold at percentage of highest value
     double threshold1;
     double threshold2;
     double threshold3;
@@ -201,10 +201,10 @@
         tricepsL= false;
         }
         
-    pc.printf("Biceps Right = %d", bicepsR);
-    pc.printf("Triceps Right = %d",tricepsR);
-    pc.printf("Biceps Left = %d", bicepsL);
-    pc.printf("Triceps Left = %d", tricepsL);
+    pc.printf("Biceps Right = %B", bicepsR);
+    pc.printf("Triceps Right = %B",tricepsR);
+    pc.printf("Biceps Left = %B", bicepsL);
+    pc.printf("Triceps Left = %B", tricepsL);
     
 }
 
@@ -284,6 +284,7 @@
       if (stateChanged)
       {
         // state initialization: green
+        t.reset();
         t.start();
         led1 = 0;
         led2 = 1;
@@ -345,10 +346,10 @@
         led1 = 1;
         led2 = 0;
         led3 = 0;
-        pc.printf("De kleur is paars ok");
-        //sample_ticker.attach(&threshold_check, ts);
-        //sample_ticker.attach(&emgsample, ts);
-        
+        wait(1);
+        sample_ticker.attach(&threshold_check, ts);
+        sample_ticker.attach(&emgsample, ts);
+                
         stateChanged = false;
       }