final version

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed

Fork of Project_script_union_final by Jorine Oosting

Revision:
12:eaed305a76c3
Parent:
11:b95b0e9e1b89
Child:
13:a3d4b4daf5b4
--- 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()*/}