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.
Dependencies: mbed HIDScope biquadFilter
Revision 1:7a90d75ff29a, committed 2018-10-30
- Comitter:
- Wabbitdrawing
- Date:
- Tue Oct 30 18:19:37 2018 +0000
- Parent:
- 0:bde34aecf9e9
- Commit message:
- fixed shit;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HIDScope.lib Tue Oct 30 18:19:37 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tomlankhorst/code/HIDScope/#eade4ec5282b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/biquadFilter.lib Tue Oct 30 18:19:37 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/tomlankhorst/code/biquadFilter/#26861979d305
--- a/main.cpp Tue Oct 30 14:57:52 2018 +0000 +++ b/main.cpp Tue Oct 30 18:19:37 2018 +0000 @@ -10,15 +10,16 @@ BiQuad emg0bq1(0.8848578, -1.7697156, 0.8848578, -1.7539023, 0.7855289); // highpass at 30Hz Q at around 1 BiQuad emg0bq2(0.0773021,0.1546042,0.0773021,-1.3098283,0.6190368); // lowpass at 130 Hz Q at around .6 BiQuad emg0bq3(0.9556457,-1.81774618, 0.955645, -1.817746, 0.9112914); // 50 Hz notch Q at 4.5 -BiQuadChain emg0bqc; // merged chain of three filters - - +BiQuadChain emg0bqc1; // merged chain of three filters +BiQuadChain emg0bqc2; +BiQuadChain emg0bqc3; int emg0Bool = 0; // I don't know if these NEED to be global, but when I tried to put them in they wouldn't work... int emg0Ignore = 0; double input = 0; // raw input double filtHigh = 0; // filtered after highpass double filtlow = 0; // filtered after lowpass double filtNotch = 0; // filtered after notch +double emg0filteredAbs; Ticker sample_timer; HIDScope scope( 5 ); DigitalOut led(LED1); @@ -28,11 +29,11 @@ void sample(){ input = emg0.read(); scope.set( 0, input); - filtHigh = emg0bq1.step(emg0.read); + filtHigh = emg0bqc1.step(emg0.read()); scope.set( 1, filtHigh); - filtLow = emg0bq2.step(filtHigh); - scope.set( 2, filtLow); - filtNotch = emg0bq3.step( filtLow); + filtlow = emg0bqc2.step(emg0.read()); + scope.set( 2, filtlow); + filtNotch = emg0bqc3.step(emg0.read()); scope.set( 3, filtNotch); emg0filteredAbs = fabs(filtNotch); if (emg0filteredAbs > 0.05) { // when above threshold set bool to 1, here can the parameters be changed using global variables @@ -51,7 +52,9 @@ } int main() { - emg0bqc.add( &emg0bq1 ).add( &emg0bq2 ).add ( &emg0bq3 ); // combining biquad chains is done in main, before the ticker, so only once. + emg0bqc1.add( &emg0bq1 ); + emg0bqc2.add( &emg0bq1 ).add( &emg0bq2 ); + emg0bqc2.add( &emg0bq1 ).add( &emg0bq2 ).add ( &emg0bq3 ); // combining biquad chains is done in main, before the ticker, so only once. sample_timer.attach(&sample, 0.001); //ticker at 1000Hz /*empty loop, sample() is executed periodically*/ while(1) {}
--- a/mbed.bld Tue Oct 30 14:57:52 2018 +0000 +++ b/mbed.bld Tue Oct 30 18:19:37 2018 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file +https://os.mbed.com/users/mbed_official/code/mbed/builds/aae6fcc7d9bb \ No newline at end of file