kakding

Dependencies:   HIDScope biquadFilter mbed

Fork of biquad2_2 by group14 - k9

Files at this revision

API Documentation at this revision

Comitter:
Paashaas
Date:
Thu Oct 22 12:18:58 2015 +0000
Parent:
2:192bd1385db6
Commit message:
elke filter in een aparte ticker

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 192bd1385db6 -r faa029d96ac3 main.cpp
--- a/main.cpp	Wed Oct 21 13:35:04 2015 +0000
+++ b/main.cpp	Thu Oct 22 12:18:58 2015 +0000
@@ -7,9 +7,13 @@
 AnalogIn emg3(A2); // 3e board
 AnalogIn emg4(A3); // bovenste board
 
-Ticker sample_ticker; // naam van de emg-ticker
+Ticker sample_ticker_1; // naam van 1e emg-ticker
+Ticker sample_ticker_2; // naam van 2e emg-ticker
+Ticker sample_ticker_3; // naam van 3e emg-ticker
+Ticker sample_ticker_4; // naam van 4e emg-ticker
 
-HIDScope scope(3);  // aantal kanalen voor je HIDScope
+
+HIDScope scope(4);  // aantal kanalen voor je HIDScope
 
 //highpass filter 20 Hz
 const double numhigh_1 = 0.956543225556877;
@@ -69,7 +73,7 @@
 
 double y5_1, y5_2, y5_3, y5_4;
 
-void myController()
+void emg_sample_1()
 {
 
 double y1_1 = highpass.step ( emg1.read() );
@@ -77,19 +81,37 @@
 double y3_1 = notch2.step (y2_1);
 double y4_1 = abs(y3_1);
         y5_1 = lowpass.step (y4_1);
+        
+scope.set(0,y5_1);        
+        
+}    
+
+void emg_sample_2()
+{    
     
 double y1_2 = highpass_2.step ( emg2.read() );
 double y2_2 = notch1_2.step (y1_2);
 double y3_2 = notch2_2.step (y2_2);
 double y4_2 = abs(y3_2);
         y5_2 = lowpass_2.step (y4_2);
+        
+scope.set(1,y5_2);
+}
+
+void emg_sample_3()
+{
     
 double y1_3 =  highpass_3.step ( emg3.read() );
 double y2_3 =  notch1_3.step (y1_3);
 double y3_3 =  notch2_3.step (y2_3);
 double y4_3 =  abs(y3_3);
         y5_3 =  lowpass_3.step (y4_3);
+        
+scope.set(2,y5_3);
+}
 
+void emg_sample_4()
+{
     
 double y1_4 =  highpass_4.step ( emg4.read() );
 double y2_4 =  notch1_4.step (y1_4);
@@ -98,14 +120,15 @@
         y5_4 =  lowpass_4.step (y4_4);
 
 
-scope.set(0,y5_1);
-scope.set(1,y5_2);
-scope.set(2,y5_3);
+scope.set(3,y5_4);
 scope.send();
 }
 
 int main()
 {
-    sample_ticker.attach(&myController,0.002);
+    sample_ticker_1.attach(&emg_sample_1,0.002);
+    sample_ticker_2.attach(&emg_sample_2,0.002);
+    sample_ticker_3.attach(&emg_sample_3,0.002);
+    sample_ticker_4.attach(&emg_sample_4,0.002);
    while (true){}  
 }  
\ No newline at end of file