Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: PID_VelocityExample TheProgram Passief_stuurprogramma Actief_stuurprogramma
Diff: EMG.h
- Revision:
- 3:0662d78d9092
- Parent:
- 2:84ff5b0f5406
- Child:
- 4:963e903c2236
--- a/EMG.h Mon Oct 12 09:33:07 2015 +0000 +++ b/EMG.h Mon Oct 12 09:41:48 2015 +0000 @@ -2,17 +2,17 @@ #include <cmath> -int Fs = 512; // sampling frequency -const double low_b1 = 1.480219865318266e-04; //filter coefficients - second order butterworth filters at 2 hz low and 25 hz high, coefficents based on Fs of 512. -const double low_b2 = 2.960439730636533e-04; -const double low_b3 = 1.480219865318266e-04; -const double low_a2 = -1.965293372622690e+00; // a1 is normalized to 1 -const double low_a3 = 9.658854605688177e-01; -const double high_b1 = 8.047897937631126e-01; -const double high_b2 = -1.609579587526225e+00; -const double high_b3 = 8.047897937631126e-01; -const double high_a2 = -1.571102440190402e+00; // a1 is normalized to 1 -const double high_a3 = 6.480567348620491e-01; +int Fs = 200; // sampling frequency +const double low_b1 = 0.000944691843840; //filter coefficients - second order butterworth filters at 2 hz low and 25 hz high, coefficents based on Fs of 512. +const double low_b2 = 0.001889383687680; +const double low_b3 = 0.000944691843840; +const double low_a2 = -1.911197067426073; // a1 is normalized to 1 +const double low_a3 = 0.914975834801434; +const double high_b1 = 0.569035593728849; +const double high_b2 = -1.138071187457699; +const double high_b3 = 0.569035593728849; +const double high_a2 = -0.942809041582063; // a1 is normalized to 1 +const double high_a3 = 0.333333333333333; biquadFilter highpass1(high_a2, high_a3, high_b1, high_b2, high_b3); // different objects for different inputs, otherwise the v1 and v2 variables get fucked up biquadFilter highpass2(high_a2, high_a3, high_b1, high_b2, high_b3); biquadFilter highpass3(high_a2, high_a3, high_b1, high_b2, high_b3); @@ -34,7 +34,7 @@ Ticker T1; volatile bool sample_go; -DigitalOut led(LED_RED); + InterruptIn cali_button(PTA4); // initialize interrupt button for calibration stuff double cali_fact1 = 8; double cali_fact2 = 8; // calibration factor to normalize filter output to a scale of 0 - 1