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: HIDScope MODSERIAL QEI biquadFilter mbed
Fork of Project_script_union_final by
Revision 12:eaed305a76c3, committed 2018-10-19
- Comitter:
- MarijkeZondag
- Date:
- Fri Oct 19 14:39:35 2018 +0000
- Parent:
- 11:b95b0e9e1b89
- Child:
- 13:a3d4b4daf5b4
- Commit message:
- Alleen nog moving average erin pleuren;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 19 14:15:43 2018 +0000
+++ b/main.cpp Fri Oct 19 14:39:35 2018 +0000
@@ -22,7 +22,8 @@
//Global variables
-int encoder = 0;
+int encoder = 0;
+const float T = 0.001f; //Ticker period
//Biquad
BiQuadChain emg0band;
@@ -44,8 +45,8 @@
//Tickers
-Ticker emg_filter_tick;
-Ticker Mov_av_tick;
+Ticker filter_tick;
+Ticker MovAg_tick;
//Functions
void EMGFilter0()
@@ -72,6 +73,18 @@
double notch2 = notch1.step(absolute2);
}
+void emg_filtered() //call all filter functions
+{
+ EMGFilter0();
+ EMGFilter1();
+ EMGFilter2();
+}
+
+void MovAg() //calculate moving average
+{
+ for i =
+}
+
void encoderA_rise()
{
if(encoderB==false)
@@ -130,9 +143,9 @@
//EMG signaal filteren
- // Deze? of die hierondbqc.add( &bq1 ).add( &bq2 ).add( &bq3 );
- bqc = bq1 * bq2 * bq3;
- emgSampleTicker.attach(&emgSample,0.01); //100 Hz
+ filter_tick.attach(&emg_filtered,T); //EMG signals filtered every T sec.
+ MovAg_tick.attach(&MovAg,T); //Moving average calculation every T sec.
+
while(true){/*do not return from main()*/}
