![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
f
Dependencies: HIDScope biquadFilter mbed
main.cpp
- Committer:
- JurrienBos
- Date:
- 2018-10-29
- Revision:
- 0:6c6907217e7a
File content as of revision 0:6c6907217e7a:
#include "mbed.h" #include "BiQuad.h" #include "HIDScope.h" Ticker sample_timer; HIDScope scope(2); BiQuadChain bqc; BiQuad BqNotch1( 9.98224e-01, -1.61516e+00, 9.98224e-01, -1.61555e+00, 9.98222e-01 ); BiQuad BqNotch2( 1.00000e+00, -1.61804e+00, 1.00000e+00, -1.61764e+00, 9.98227e-01 ); BiQuad BqHP( 9.86760e-01, -1.97352e+00, 9.86760e-01, -1.97334e+00, 9.73695e-01 ); //BiQuad BqLP( 3.46041e-04, 6.92083e-04, 3.46041e-04, -1.94670e+00, 9.48082e-01 ); Ticker emgSampleTicker; AnalogIn emg0( A0 ); AnalogIn emg1 (A1) ; //volatile double emgFiltered; //volatile double emgSampleabs; void emgSample() { double emgFiltered = bqc.step( emg0.read() ); bqc.add( &BqNotch1 ).add( &BqNotch2 ).add( &BqHP ); //emgSampleabs = fabs(emgFiltered); } void sample() { scope.set(0, emg0.read() ); scope.set(1, emg1.read() ); scope.send(); } int main() { emgSampleTicker.attach( &emgSample, 0.01 ); sample_timer.attach(&sample, 0.002); while( true ){} }