met printstatements 1

Dependencies:   HIDScope MODSERIAL PID QEI biquadFilter mbed

Fork of EMG_5 by Ralph Gerlings

Revision:
28:ec0763106a2e
Parent:
27:ca07f895f999
Child:
29:09c1567d6148
--- a/main.cpp	Tue Oct 10 13:46:49 2017 +0000
+++ b/main.cpp	Tue Oct 10 14:17:03 2017 +0000
@@ -2,6 +2,7 @@
 #include "HIDScope.h"
 #include "BiQuad.h"
 #include "MODSERIAL.h"
+#include "Calibration.h"
 
 //Define objects
     AnalogIn    emg1_in( A0 ); /* read out the signal */
@@ -82,43 +83,6 @@
     BiQuad filterlow4(1.368e-03,2.737e-03,1.369e-03,-1.9219,9.274e-01);
     //
 
-// Finding max values for correct motor switch if the button is pressed
-void get_max1(){
-    if (max_reader12==0){
-            green = !green;
-            red = 1;
-            blue = 1;
-            for(int n=0;n<2000;n++){  /* measure 2000 samples and filter it */
-
-            emg1 = emg1_in.read();      /* read out emg */
-            emg1highfilter = filterhigh1.step(emg1); /* high pass filtered */
-            emg1notchfilter = filternotch1.step(emg1highfilter); /* notch filtered */
-            emg1abs = fabs(emg1notchfilter); /* take the absolute value */
-            emg1lowfilter = filterlow1.step(emg1abs); /* low pass filtered */
-            emg1peak = filterpeak1.step(emg1lowfilter); /* 4dB gain peak */
-            
-            emg2 = emg2_in.read();      /* read out emg */
-            emg2highfilter = filterhigh2.step(emg2); /* high pass filtered */
-            emg2notchfilter = filternotch2.step(emg2highfilter); /* notch filtered */
-            emg2abs = fabs(emg2notchfilter); /* take the absolute value */
-            emg2lowfilter = filterlow2.step(emg2abs); /* low pass filtered */
-            emg2peak = filterpeak2.step(emg2lowfilter); /* 4dB gain peak */
-            
-            if (max1<emg1peak){
-                max1 = emg1peak; /* set the max value at the highest measured value */
-            }
-            if (max2<emg2peak){
-                max2 = emg2peak; /* set the max value at the highest measured value */                
-            }
-            wait(0.001f); /* measure at 1000Hz */   
-            }
-            wait(0.2f);
-            green = 1;
-    }
-    maxpart1 = 0.15*max1; /* set cut off voltage at 15% of max for right biceps */
-    maxpart2 = 0.15*max1; /* set cut off votage at 15% of max for left biceps */
-}
-
 void get_max3(){
     if (max_reader34==0){
             green = 1;
@@ -151,8 +115,8 @@
             wait(0.2f);
             red = 1;
     }
-    maxpart3 = 0.25*max3; /* set cut off voltage at 25% of max for left lower arm */
-    maxpart4 = 0.25*max4; /* set cut off voltage at 25% of max for right lower arm */
+    maxpart3 = 0.2*max3; /* set cut off voltage at 25% of max for left lower arm */
+    maxpart4 = 0.2*max4; /* set cut off voltage at 25% of max for right lower arm */
 }
 
 // Filtering & Scope