Werkcollege opgave 23 september BMT K9
Dependencies: Encoder HIDScope MODSERIAL mbed QEI biquadFilter
Diff: main.cpp
- Revision:
- 16:ca457fa8257f
- Parent:
- 15:7870f7912904
--- a/main.cpp Wed Oct 07 15:34:30 2015 +0000 +++ b/main.cpp Wed Oct 07 15:42:23 2015 +0000 @@ -9,18 +9,26 @@ //Define constants float emgL_L; +float emgL_LH; Ticker looptimer; volatile bool looptimerflag; -const float a1 = 0; -const float a2 = 0.17156822136; -const float b0 = 0.2928920553; -const float b1 = 0.5857841107; -const float b2 = 0.2928920554; // Waarde van biquads via groep 1 2014 -biquadFilter Lowpassfilter (a1, a2, b0, b1, b2); +const float la1 = 0; +const float la2 = 0.17156822136; +const float lb0 = 0.2928920553; +const float lb1 = 0.5857841107; +const float lb2 = 0.2928920554; // Waarde van biquads via groep 1 2014 +biquadFilter Lowpassfilter (la1, la2, lb0, lb1, lb2); -HIDScope scope(1); // 1 HIDScope kanaal +const float ha1 = -1.5610153913; +const float ha2 = 0.6413487154; +const float hb0 = 0.8005910267; +const float hb1 = -1.6011820533; +const float hb2 = 0.8005910267; // Waarde van biquads via groep 1 2014 +biquadFilter Highpassfilter (ha1, ha2, hb0, hb1, hb2); + +HIDScope scope(3); void setlooptimerflag(void) { @@ -29,14 +37,17 @@ int main() { - looptimer.attach(setlooptimerflag,0.01); + looptimer.attach(setlooptimerflag, 0.01); while(true) { while (looptimerflag !=true) { looptimerflag = false; emgL_L = Lowpassfilter.step(emgL); //emgL_L Linker bicep met lowpass filter + emgL_LH = Highpassfilter.step(emgL_L); } - scope.set(0,emgL_L); + scope.set(0,emgL); + scope.set(1,emgL_L); + scope.set(2,emgL_LH); scope.send(); } } \ No newline at end of file