met printstatements 1
Dependencies: HIDScope MODSERIAL PID QEI biquadFilter mbed
Fork of EMG_5 by
Diff: main.cpp
- Revision:
- 24:26659f1de039
- Parent:
- 23:e5db011bd410
- Child:
- 25:07187cf76863
--- a/main.cpp Thu Nov 03 12:17:16 2016 +0000 +++ b/main.cpp Thu Nov 03 13:40:17 2016 +0000 @@ -29,6 +29,7 @@ double emg1abs; double emg1lowfilter; double emg1peak; + double maxpart1; // Left Biceps double emg2; double emg2highfilter; @@ -37,7 +38,7 @@ double emg2lowfilter; double emg2peak; double max1; - double maxpart1; + double maxpart2; // Left Lower Arm OR Triceps double emg3; double emg3highfilter; @@ -52,18 +53,18 @@ // Right Biceps BiQuad filterhigh1(9.704e-01,-1.9408,9.704e-01,-1.9389,9.427e-01); /* Filter at 10 Hz */ BiQuad filternotch1(9.495e-01,-1.8062,9.495e-01,-1.8062,8.992e-01); /* Filter at 50 Hz */ - BiQuad filterlow1(2.119e-03,4.238e-03,2.119e-03,-1.9016,9.101e-01); /* Filter at 15 Hz */ - BiQuad filterpeak1(1.0123,-1.983,9.761e-01,-1.9838,9.8855e-01); /* Gain peak at 11 Hz */ + BiQuad filterpeak1(1.0033,-1.984,9.852e-01,-1.9838,9.8855e-01); /* Gain peak at 11 Hz */ + BiQuad filterlow1(1.368e-03,2.737e-03,1.369e-03,-1.9219,9.274e-01); /* Filter at 15 Hz */ // Left Biceps BiQuad filterhigh2(9.704e-01,-1.9408,9.704e-01,-1.9389,9.427e-01); BiQuad filternotch2(9.495e-01,-1.8062,9.495e-01,-1.8062,8.992e-01); - BiQuad filterlow3(2.119e-03,4.238e-03,2.119e-03,-1.9016,9.101e-01); - BiQuad filterpeak2(1.0123,-1.983,9.761e-01,-1.9838,9.8855e-01); + BiQuad filterpeak2(1.0033,-1.984,9.852e-01,-1.9838,9.8855e-01); + BiQuad filterlow2(1.368e-03,2.737e-03,1.369e-03,-1.9219,9.274e-01); // Left Lower Arm OR Triceps BiQuad filterhigh3(9.704e-01,-1.9408,9.704e-01,-1.9389,9.427e-01); BiQuad filternotch3(9.495e-01,-1.8062,9.495e-01,-1.8062,8.992e-01); - BiQuad filterlow3(2.119e-03,4.238e-03,2.119e-03,-1.9016,9.101e-01); - BiQuad filterpeak3(1.0123,-1.983,9.761e-01,-1.9838,9.8855e-01); + BiQuad filterpeak3(1.0033,-1.984,9.852e-01,-1.9838,9.8855e-01); + BiQuad filterlow3(1.368e-03,2.737e-03,1.369e-03,-1.9219,9.274e-01); // // Finding max values for correct motor switch @@ -89,7 +90,8 @@ wait(0.2f); green = 1; } - maxpart1 = 0.35*max1; + maxpart1 = 0.28*max1; + maxpart2 = 0.18*max1; } void get_max3(){ @@ -114,7 +116,7 @@ wait(0.2f); red = 1; } - maxpart3 = 0.3*max3; + maxpart3 = 0.28*max3; } // Filtering & Scope @@ -149,14 +151,14 @@ green = 1; } else { - if (maxpart1<emg2peak){ + if (maxpart2<emg2peak){ red = 1; blue = 0; green = 1; } else { - if (maxpart3<emg2peak){ + if (maxpart3<emg3peak){ red = 1; blue = 1; green = 0;