EMG signals all around zero, not showing differences anymore in hidscope

Dependencies:   HIDScope MODSERIAL biquadFilter mbed

Fork of a_check_emg_filtered_without_cal by Daniqe Kottelenberg

--- a/main.cpp	Mon Oct 24 10:22:54 2016 +0000
+++ b/main.cpp	Mon Oct 24 11:24:50 2016 +0000
@@ -4,7 +4,7 @@
 #include "BiQuad.h"  
 //Define objects
-AnalogIn    emg0( A0 );             //analog in to get EMG in to c++
+AnalogIn    emg_biceps_right_in( A0 );             //analog in to get EMG in to c++
 Ticker      sample_timer;           //ticker
 HIDScope    scope( 3);              //open 3 channels in hidscope
 DigitalOut richting_motor1(D4);     //motor1 direction output    
@@ -12,30 +12,33 @@
 DigitalOut  led(LED_GREEN);
 //define variables
-double emg_0_value;
-double emg_gefilterd;
-double emg_abs;
+double emg_biceps_right;
+double emg_filtered_high_biceps_right;
+double emg_abs_biceps_right;
+double emg_filtered_biceps_right;
 int    onoffsignal=0;
-double cut_off_value=0.05; //gespecifeerd door floortje
+double cut_off_value=0.08; //gespecifeerd door floortje
-BiQuad filterhigh1(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01);
+BiQuad filterhigh(9.5654e-01,-1.9131e+00,9.5654e-01,-1.9112e+00,9.1498e-01);
+BiQuad filterlow (6.2942e-06, 1.2588e-05,6.2942e-06,-1.9929e+00,9.9292e-01);
+//functions which are called in ticker
 void filter(){
-        emg_0_value=emg0.read();                            //read the emg value from the elektrodes
-        emg_gefilterd= filterhigh1.step(emg_0_value);
-        emg_abs=abs(emg_gefilterd);
+        emg_biceps_right=emg_biceps_right_in.read();                            //read the emg value from the elektrodes
+        emg_filtered_high_biceps_right= filterhigh.step(emg_biceps_right);
+        emg_abs_biceps_right=fabs(emg_filtered_high_biceps_right); //fabs because float
+        emg_filtered_biceps_right=filterlow.step(emg_abs_biceps_right);
-        if (emg_abs>cut_off_value)
+        if (emg_filtered_biceps_right>cut_off_value)
         //send signals  to scope
-        scope.set(0, emg_0_value );           //set emg signal to scope in channel 1
-        scope.set(1, emg_gefilterd );    
+        scope.set(0, emg_biceps_right );           //set emg signal to scope in channel 1
+        scope.set(1, emg_filtered_biceps_right);    
         scope.set(2, onoffsignal);
         scope.send();                       //send all the signals to the scope