now with PID controler XXXD

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed

Fork of another_try_from_scratch_on_emg by Daniqe Kottelenberg

Revision:
27:b8d61361d709
Parent:
26:38dc21b9ba7d
Child:
28:e2553066989e
--- a/main.cpp	Fri Oct 28 08:10:07 2016 +0000
+++ b/main.cpp	Fri Oct 28 08:19:14 2016 +0000
@@ -13,7 +13,8 @@
 
 Ticker      sample_timer;               //ticker
 Ticker      switch_function;            //ticker
-Ticker      calibration_ticker          //ticker
+Ticker      calibration_ticker_biceps   //ticker
+Ticker      calibratio_ticker_triceps   //ticker
 HIDScope    scope(5);                   //open 3 channels in hidscope
 MODSERIAL pc(USBTX, USBRX);             //pc connection
 
@@ -158,8 +159,8 @@
                 }
 
 //calibration function
-void calibration(){
-            if(button_calibration==0)
+void calibration_biceps(){
+            if(button_calibration_biceps==0)
             {
             for(int n =0; n<2000;n++)                                                  //read for 5000 samples as calibration
                 {
@@ -171,7 +172,9 @@
             if (emg_filtered_biceps_right > max_right_biceps)                    //determine what the highest reachable emg signal is
                 {
             max_right_biceps = emg_filtered_biceps_right;
+            
                 }
+                wait(0.001f); //to sample at same freq; 1000Hz
                 }
             cut_off_value=0.2*max_right_biceps; 
             pc.printf(" change of cv %f ",cut_off_value );