Poep Hoofd / Mbed 2 deprecated PoolRobot_Code

Dependencies:   HIDScope mbed MODSERIAL QEI

Revision:
2:a08bff88216d
Parent:
1:50ae89200a53
Child:
3:9c5aea210f1d
--- a/main.cpp	Fri Oct 13 09:50:30 2017 +0000
+++ b/main.cpp	Fri Oct 13 10:16:31 2017 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
-#include"BiQuadFilter.h"
+#include"BiQuad.h"
 #include "HIDScope.h"
+#include "MODSERIAL.h"
 
 //Initialize Analog EMG inputs
 AnalogIn    EMGData_1( A0 );
@@ -15,7 +16,7 @@
 
 double EMG_MainsReject_1 = 0;
 double EMG_MainsReject_2 = 0;
-double EMG_MainsReject3 = 0;
+double EMG_MainsReject_3 = 0;
 double EMG_Filtered_1 = 0;
 double EMG_Filtered_2 = 0;
 double EMG_Filtered_3 = 0;
@@ -26,39 +27,26 @@
 double EMG_Envelope_2 = 0;
 double EMG_Envelope_3 = 0;
 
-int main(void)
-{
-    pc.baud(115200);    //Set Baud rate for Serial communication
-    MainTicker.attach(&ReadAndFilterEMG, Ts);    //Attach time based interrupt
-    
-    //High Pass Filter
-    double A0=1,                        A1=-1.475480443592646,          A2=0.586919508061190,
-           B0=0.765599987913459,        B1=-1.531199975826918,          B2=0.765599987913459;
-           
-    BiQuad HiPass(B0, B1, B2, A0, A1, A2);
-    /***********/
-    
-    //Low Pass Filter
-    double A0=1,                        A1=-1.307285028849324,          A2=0.491812237222575,
-           B0=0.0009446918438401619,    B1=0.001889383687680,           B2=0.0009446918438401619;
+//High Pass Filter
+double a_0_0=1,                        a_0_1=-1.475480443592646,          a_0_2=0.586919508061190,
+       b_0_0=0.765599987913459,        b_0_1=-1.531199975826918,          b_0_2=0.765599987913459;
            
-    BiQuad LoPass(B0, B1, B2, A0, A1, A2);
-    /***********/
+BiQuad HiPass(b_0_0, b_0_1, b_0_2, a_0_0, a_0_1, a_0_2);
+/***********/
     
-    //Notch Filter
-    double A0=1,                        A1=-1.525271192436899,          A2=0.881618592363190,
-           B0=0.940809296181595,        B1=-1.525271192436899,          B2=0.940809296181595;
+//Low Pass Filter
+double a_1_0=1,                        a_1_1=-1.307285028849324,          a_1_2=0.491812237222575,
+       b_1_0=0.0009446918438401619,    b_1_1=0.001889383687680,           b_1_2=0.0009446918438401619;
            
-    BiQuad MainsReject(B0, B1, B2, A0, A1, A2);
-    /***********/
+BiQuad LoPass(b_1_0, b_1_1, b_1_2, a_1_0, a_1_1, a_1_2);
+/***********/
     
-    while(true)
-    {
-        
-    }
-    
-    return 0;
-}
+//Notch Filter
+double a_2_0=1,                        a_2_1=-1.525271192436899,          a_2_2=0.881618592363190,
+       b_2_0=0.940809296181595,        b_2_1=-1.525271192436899,          b_2_2=0.940809296181595;
+           
+BiQuad MainsReject(b_2_0, b_2_1, b_2_2, a_2_0, a_2_1, a_2_2);
+/***********/
 
 void ReadAndFilterEMG()
 {    
@@ -93,6 +81,20 @@
     scope.set(3, EMG_Envelope_1);   //Envelope Detected output
     
     scope.send();
-    /*****/
+    /*****/ 
+}
+
+int main(void)
+{
+    pc.baud(115200);    //Set Baud rate for Serial communication
+    MainTicker.attach(&ReadAndFilterEMG, Ts);    //Attach time based interrupt
     
+    /*
+    while(true)
+    {
+        
+    }
+    */
+    
+    return 0;
 }
\ No newline at end of file