filters emg signaal
Dependencies: HIDScope MODSERIAL biquadFilter mbed
Revision 0:9fc3cc2f74db, committed 2018-10-22
- Comitter:
- Roooos
- Date:
- Mon Oct 22 08:13:40 2018 +0000
- Commit message:
- filters emg groep 2;
Changed in this revision
diff -r 000000000000 -r 9fc3cc2f74db HIDScope.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HIDScope.lib Mon Oct 22 08:13:40 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tomlankhorst/code/HIDScope/#d23c6edecc49
diff -r 000000000000 -r 9fc3cc2f74db MODSERIAL.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Mon Oct 22 08:13:40 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/MODSERIAL/#da0788f0bd77
diff -r 000000000000 -r 9fc3cc2f74db biquadFilter.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/biquadFilter.lib Mon Oct 22 08:13:40 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/tomlankhorst/code/biquadFilter/#26861979d305
diff -r 000000000000 -r 9fc3cc2f74db main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 22 08:13:40 2018 +0000 @@ -0,0 +1,40 @@ +#include "mbed.h" +#include "HIDScope.h" +//#include "BiQuad.h" + +//Define EMG parameters +AnalogIn emg0(A0); //emg signaal 1 +Ticker sample_timer; +HIDScope scope( 2 ); // aantal channels op de HIDscope +volatile double emg_1; +DigitalOut led(LED_GREEN); + + + +//compute biquad function door Biquad(b0, b1, b2, a0, a1) in te vullen +//BiQuadChain bqc; //chain voor High Pass en Notch +//BiQuad bq1(0.39131200825291007, -0.7826240165058201, 0.39131200825291007, -0.36950493743858204, 0.1957430955730582); //High Pass Filter +//BiQuad bq2( 9.91104e-01, -1.60364e+00, 9.91104e-01, -1.60364e+00, 9.82207e-01); //Notch Filter +//BiQuad bq3(0.06947941610796837, 0.13895883221593675, 0.06947941610796837, -1.1772781186813919, 0.4551957831132653); //Low Pass Filter + + +void sample() +{ + emg_1 = emg0.read(); //EMG signal + // double FilterStep1 = bqc.step(emg_1); //High Pass + Notch + //double RectifyEMG = fabs(FilterStep1); //Rectify Signal + // double Filtered_emg_1 = bq3.step(RectifyEMG); //Low Pass + + // scope.set(0,emg_1); //set raw emg signal + // scope.set(1,Filtered_emg_1); //set filtered emg signal + + // scope.send(); //send to hidscope +} + +int main() +{ + led = 0; + // bqc.add( &bq1 ).add( &bq2 ); //make BiQuadChain + sample_timer.attach(&sample, 0.002); //500 Hz + while (1) {} +} \ No newline at end of file
diff -r 000000000000 -r 9fc3cc2f74db mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 22 08:13:40 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file