filters aangepast en bepaling threshold
Dependencies: HIDScope MODSERIAL biquadFilter mbed
Fork of EMGV3 by
Diff: main.cpp
- Revision:
- 28:38d21b78c6aa
- Parent:
- 27:aa5ffd7227a5
- Child:
- 29:c43e9f78db37
diff -r aa5ffd7227a5 -r 38d21b78c6aa main.cpp --- a/main.cpp Tue Oct 13 13:30:16 2015 +0000 +++ b/main.cpp Wed Oct 14 12:28:49 2015 +0000 @@ -104,105 +104,16 @@ void MovingAverageFilterLeft() { EMG_left_MAF = (MAF_left[0]+MAF_left[1]+MAF_left[2]+MAF_left[3]+MAF_left[4]+MAF_left[5]+MAF_left[6]+MAF_left[7]+MAF_left[8]+MAF_left[9]+MAF_left[10]+MAF_left[11]+MAF_left[12]+MAF_left[13]+MAF_left[14]+MAF_left[15]+MAF_left[16]+MAF_left[17]+MAF_left[18]+MAF_left[19]+MAF_left[20]+MAF_left[21]+MAF_left[22]+MAF_left[23]+MAF_left[24]+MAF_left[25]+MAF_left[26]+MAF_left[27]+MAF_left[28]+MAF_left[29]+MAF_left[30]+MAF_left[31]+MAF_left[32]+MAF_left[33]+MAF_left[34]+MAF_left[35]+MAF_left[36]+MAF_left[37]+MAF_left[38]+MAF_left[39]+MAF_left[40]+MAF_left[41]+MAF_left[42]+MAF_left[43]+MAF_left[44]+MAF_left[45]+MAF_left[46]+MAF_left[47]+MAF_left[48]+MAF_left[49])/N; - MAF_left[49] = MAF_left[48], MAF_left[48] = MAF_left[47], MAF_left[47] = MAF_left[46], MAF_left[46] = MAF_left[45], MAF_left[45] = MAF_left[44];MAF_left[44] = MAF_left[43]; - MAF_left[43] = MAF_left[42]; - MAF_left[42] = MAF_left[41]; - MAF_left[41] = MAF_left[40]; - MAF_left[40] = MAF_left[39]; - MAF_left[39] = MAF_left[38]; - MAF_left[38] = MAF_left[37]; - MAF_left[37] = MAF_left[36]; - MAF_left[36] = MAF_left[35]; - MAF_left[35] = MAF_left[34]; - MAF_left[34] = MAF_left[33]; - MAF_left[33] = MAF_left[32]; - MAF_left[32] = MAF_left[31]; - MAF_left[31] = MAF_left[30]; - MAF_left[30] = MAF_left[29]; - MAF_left[29] = MAF_left[28]; - MAF_left[28] = MAF_left[27]; - MAF_left[27] = MAF_left[26]; - MAF_left[26] = MAF_left[25]; - MAF_left[25] = MAF_left[24]; - MAF_left[24] = MAF_left[23]; - MAF_left[23] = MAF_left[22]; - MAF_left[22] = MAF_left[21]; - MAF_left[21] = MAF_left[20]; - MAF_left[20] = MAF_left[19]; - MAF_left[19] = MAF_left[18]; - MAF_left[18] = MAF_left[17]; - MAF_left[17] = MAF_left[16]; - MAF_left[16] = MAF_left[15]; - MAF_left[15] = MAF_left[14]; - MAF_left[14] = MAF_left[13]; - MAF_left[13] = MAF_left[12]; - MAF_left[12] = MAF_left[11]; - MAF_left[11] = MAF_left[10]; - MAF_left[10] = MAF_left[9]; - MAF_left[9] = MAF_left[8]; - MAF_left[8] = MAF_left[7]; - MAF_left[7] = MAF_left[6]; - MAF_left[6] = MAF_left[5]; - MAF_left[5] = MAF_left[4]; - MAF_left[4] = MAF_left[3]; - MAF_left[3] = MAF_left[2]; - MAF_left[2] = MAF_left[1]; - MAF_left[1] = MAF_left[0]; + MAF_left[49] = MAF_left[48], MAF_left[48] = MAF_left[47], MAF_left[47] = MAF_left[46], MAF_left[46] = MAF_left[45], MAF_left[45] = MAF_left[44], MAF_left[44] = MAF_left[43], MAF_left[43] = MAF_left[42], MAF_left[42] = MAF_left[41], MAF_left[41] = MAF_left[40], MAF_left[40] = MAF_left[39], MAF_left[39] = MAF_left[38], MAF_left[38] = MAF_left[37], MAF_left[37] = MAF_left[36], MAF_left[36] = MAF_left[35], MAF_left[35] = MAF_left[34], MAF_left[34] = MAF_left[33], MAF_left[33] = MAF_left[32], MAF_left[32] = MAF_left[31], MAF_left[31] = MAF_left[30], MAF_left[30] = MAF_left[29], MAF_left[29] = MAF_left[28], MAF_left[28] = MAF_left[27], MAF_left[27] = MAF_left[26], MAF_left[26] = MAF_left[25]; + MAF_left[25] = MAF_left[24], MAF_left[24] = MAF_left[23], MAF_left[23] = MAF_left[22], MAF_left[22] = MAF_left[21], MAF_left[21] = MAF_left[20], MAF_left[20] = MAF_left[19], MAF_left[19] = MAF_left[18], MAF_left[18] = MAF_left[17], MAF_left[17] = MAF_left[16], MAF_left[16] = MAF_left[15], MAF_left[15] = MAF_left[14], MAF_left[14] = MAF_left[13], MAF_left[13] = MAF_left[12], MAF_left[12] = MAF_left[11], MAF_left[11] = MAF_left[10], MAF_left[10] = MAF_left[9], MAF_left[9] = MAF_left[8], MAF_left[8] = MAF_left[7], MAF_left[7] = MAF_left[6], MAF_left[6] = MAF_left[5], MAF_left[5] = MAF_left[4], MAF_left[4] = MAF_left[3], MAF_left[3] = MAF_left[2], MAF_left[2] = MAF_left[1], MAF_left[1] = MAF_left[0]; MAF_left[0] = EMG_left_f6; } void MovingAverageFilterRight() { EMG_right_MAF = (MAF_right[0]+MAF_right[1]+MAF_right[2]+MAF_right[3]+MAF_right[4]+MAF_right[5]+MAF_right[6]+MAF_right[7]+MAF_right[8]+MAF_right[9]+MAF_right[10]+MAF_right[11]+MAF_right[12]+MAF_right[13]+MAF_right[14]+MAF_right[15]+MAF_right[16]+MAF_right[17]+MAF_right[18]+MAF_right[19]+MAF_right[20]+MAF_right[21]+MAF_right[22]+MAF_right[23]+MAF_right[24]+MAF_right[25]+MAF_right[26]+MAF_right[27]+MAF_right[28]+MAF_right[29]+MAF_right[30]+MAF_right[31]+MAF_right[32]+MAF_right[33]+MAF_right[34]+MAF_right[35]+MAF_right[36]+MAF_right[37]+MAF_right[38]+MAF_right[39]+MAF_right[40]+MAF_right[41]+MAF_right[42]+MAF_right[43]+MAF_right[44]+MAF_right[45]+MAF_right[46]+MAF_right[47]+MAF_right[48]+MAF_right[49])/N; - MAF_right[49] = MAF_right[48]; - MAF_right[48] = MAF_right[47]; - MAF_right[47] = MAF_right[46]; - MAF_right[46] = MAF_right[45]; - MAF_right[45] = MAF_right[44]; - MAF_right[44] = MAF_right[43]; - MAF_right[43] = MAF_right[42]; - MAF_right[42] = MAF_right[41]; - MAF_right[41] = MAF_right[40]; - MAF_right[40] = MAF_right[39]; - MAF_right[39] = MAF_right[38]; - MAF_right[38] = MAF_right[37]; - MAF_right[37] = MAF_right[36]; - MAF_right[36] = MAF_right[35]; - MAF_right[35] = MAF_right[34]; - MAF_right[34] = MAF_right[33]; - MAF_right[33] = MAF_right[32]; - MAF_right[32] = MAF_right[31]; - MAF_right[31] = MAF_right[30]; - MAF_right[30] = MAF_right[29]; - MAF_right[29] = MAF_right[28]; - MAF_right[28] = MAF_right[27]; - MAF_right[27] = MAF_right[26]; - MAF_right[26] = MAF_right[25]; - MAF_right[25] = MAF_right[24]; - MAF_right[24] = MAF_right[23]; - MAF_right[23] = MAF_right[22]; - MAF_right[22] = MAF_right[21]; - MAF_right[21] = MAF_right[20]; - MAF_right[20] = MAF_right[19]; - MAF_right[19] = MAF_right[18]; - MAF_right[18] = MAF_right[17]; - MAF_right[17] = MAF_right[16]; - MAF_right[16] = MAF_right[15]; - MAF_right[15] = MAF_right[14]; - MAF_right[14] = MAF_right[13]; - MAF_right[13] = MAF_right[12]; - MAF_right[12] = MAF_right[11]; - MAF_right[11] = MAF_right[10]; - MAF_right[10] = MAF_right[9]; - MAF_right[9] = MAF_right[8]; - MAF_right[8] = MAF_right[7]; - MAF_right[7] = MAF_right[6]; - MAF_right[6] = MAF_right[5]; - MAF_right[5] = MAF_right[4]; - MAF_right[4] = MAF_right[3]; - MAF_right[3] = MAF_right[2]; - MAF_right[2] = MAF_right[1]; - MAF_right[1] = MAF_right[0]; + MAF_right[49] = MAF_right[48], MAF_right[48] = MAF_right[47], MAF_right[47] = MAF_right[46], MAF_right[46] = MAF_right[45], MAF_right[45] = MAF_right[44], MAF_right[44] = MAF_right[43], MAF_right[43] = MAF_right[42], MAF_right[42] = MAF_right[41], MAF_right[41] = MAF_right[40], MAF_right[40] = MAF_right[39], MAF_right[39] = MAF_right[38], MAF_right[38] = MAF_right[37], MAF_right[37] = MAF_right[36], MAF_right[36] = MAF_right[35], MAF_right[35] = MAF_right[34], MAF_right[34] = MAF_right[33], MAF_right[33] = MAF_right[32], MAF_right[32] = MAF_right[31], MAF_right[31] = MAF_right[30], MAF_right[30] = MAF_right[29], MAF_right[29] = MAF_right[28], MAF_right[28] = MAF_right[27], MAF_right[27] = MAF_right[26], MAF_right[26] = MAF_right[25]; + MAF_right[25] = MAF_right[24], MAF_right[24] = MAF_right[23], MAF_right[23] = MAF_right[22], MAF_right[22] = MAF_right[21], MAF_right[21] = MAF_right[20], MAF_right[20] = MAF_right[19], MAF_right[19] = MAF_right[18], MAF_right[18] = MAF_right[17], MAF_right[17] = MAF_right[16], MAF_right[16] = MAF_right[15], MAF_right[15] = MAF_right[14], MAF_right[14] = MAF_right[13], MAF_right[13] = MAF_right[12], MAF_right[12] = MAF_right[11], MAF_right[11] = MAF_right[10], MAF_right[10] = MAF_right[9], MAF_right[9] = MAF_right[8], MAF_right[8] = MAF_right[7], MAF_right[7] = MAF_right[6], MAF_right[6] = MAF_right[5], MAF_right[5] = MAF_right[4], MAF_right[4] = MAF_right[3], MAF_right[3] = MAF_right[2], MAF_right[2] = MAF_right[1], MAF_right[1] = MAF_right[0]; MAF_right[0] = EMG_right_f6; }