Error same as we first had, don't know what to do :'(

Dependencies:   BiQuad4th_order Biquad HIDScope MODSERIAL biquadFilter mbed

Revision:
1:f99650c5b9eb
Parent:
0:802c9c6b30d3
--- a/main.cpp	Wed Oct 31 12:57:37 2018 +0000
+++ b/main.cpp	Wed Oct 31 13:30:40 2018 +0000
@@ -4,7 +4,9 @@
 #include "BiQuad4.h"
 #include "FilterDesign.h"
 #include "FilterDesign2.h"
+#include "HIDScope.h"
 MODSERIAL pc(USBTX, USBRX); //makes sure the computer is hooked up
+Ticker sample;
 
 AnalogIn emg1_raw(A0);
 AnalogIn emg2_raw(A1);
@@ -16,19 +18,23 @@
 double EMG_calibrated_max_1 = 0.00000; //final calibration value of EMG1
 double EMG_calibrated_max_2 = 0.00000; //final calibration value of EMG2
 
+void ReadEMG()
+{
+    emg1_cal = FilterDesign(emg1_raw.read());
+    emg2_cal = FilterDesign2(emg2_raw.read());
+}
 
-void EMG_calibration(){
+void EMG_calibration()
+{
     for (int i = 0; i <= 10; i++) //10 measuring points
-        { 
-        emg1_cal = FilterDesign(emg1_raw.read());
-        emg2_cal = FilterDesign2(emg2_raw.read());
-        
+        {      
         if (emg1_cal > EMG_calibrated_max_1){
             EMG_calibrated_max_1 = emg1_cal;}
             
         if (emg2_cal > EMG_calibrated_max_2){
             EMG_calibrated_max_2 = emg2_cal;}
-        
+            
+        pc.printf("EMG1 = %f, EMG2 = %f \r\n",EMG_calibrated_max_1,EMG_calibrated_max_2);
         wait(0.5f);
         }
 }
@@ -37,10 +43,13 @@
 
 int main(){
     pc.baud(115200);
+    // Attach the 'ReadEMG' function to the timer 'sample'. Frequency is 5 Hz.
+    sample.attach(&ReadEMG, 0.2f);
+    
     while (true) {
         led = 0;
         EMG_calibration();
         led = 1;
-        pc.printf("EMG1 = %f, EMG2 = %f \r\n",EMG_calibrated_max_1,EMG_calibrated_max_2);
+        pc.printf("Final: EMG1 = %f, EMG2 = %f \r\n",EMG_calibrated_max_1,EMG_calibrated_max_2);
     }
 }
\ No newline at end of file