emg with text

Dependencies:   HIDScope MODSERIAL biquadFilter mbed

Fork of emg_import by Daniqe Kottelenberg

Revision:
29:76b2cc33690c
Parent:
28:e2553066989e
Child:
30:a7bae1c036a3
--- a/main.cpp	Fri Oct 28 08:35:31 2016 +0000
+++ b/main.cpp	Fri Oct 28 08:53:21 2016 +0000
@@ -8,13 +8,11 @@
 AnalogIn    emg_biceps_right_in( A0 );              //analog in to get EMG biceps  (r) in to c++
 AnalogIn    emg_triceps_right_in(A1);               //analog in to get EMG triceps (r) in to c++
 AnalogIn    emg_biceps_left_in  (A2);               //analog in to get EMG biceps  (l) in to c++
-DigitalIn   button_calibration_biceps (SW3);                //button to start calibration biceps
-DigitalIn   button_calibration_triceps (SW2);               // button to start calibration tricps
+InterruptIn   button_calibration_biceps (SW3);                //button to start calibration biceps
+InterruptIn   button_calibration_triceps (SW2);               // button to start calibration tricps
 
 Ticker      sample_timer;               //ticker
 Ticker      switch_function;            //ticker
-Ticker      calibration_ticker_biceps;   //ticker
-Ticker      calibration_ticker_triceps;   //ticker
 HIDScope    scope(5);                   //open 3 channels in hidscope
 MODSERIAL pc(USBTX, USBRX);             //pc connection
 
@@ -138,7 +136,7 @@
         scope.send();                       //send all the signals to the scope
                 }
 
-//calibration function
+//calibration function for biceps 
 void calibration_biceps(){
             if(button_calibration_biceps==0)
             {
@@ -170,7 +168,7 @@
 pc.baud(115200);
 sample_timer.attach(&filter, 0.001);        //continously execute the EMG reader and filter, it ensures that filter and sampling is executed every 1/frequency seconds
 switch_function.attach(&SwitchN,0.1);                       
-calibration_ticker_biceps.attach(&calibration_biceps,0.001); //to call calibration biceps
+button_calibration_biceps.fall(&calibration_biceps,0.001); //to call calibration biceps, stop everything else
 //endless loop
 
     while (true) {                        // zorgt er voor dat de code oneindig doorgelopen wordt