![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
emg
Dependencies: HIDScope MODSERIAL mbed-dsp mbed TouchButton
Fork of test by
Diff: main.cpp
- Revision:
- 7:c13686aecc75
- Parent:
- 6:ad6d4bd69205
- Child:
- 8:54fd13779d00
--- a/main.cpp Wed Oct 22 09:40:57 2014 +0000 +++ b/main.cpp Wed Oct 22 09:55:39 2014 +0000 @@ -98,6 +98,34 @@ B3=B2; B2=B1; B1=B0; + + uint16_t emg_valueT; + float emg_value_f32T; + + //lezen + emg_valueT = emgT.read_u16(); + emg_value_f32T = emgT.read(); + + //filteren + arm_biquad_cascade_df1_f32(&highpass, &emg_value_f32T, &filtered_emgT, 1 ); + filtered_emgT = fabs(filtered_emgT); + arm_biquad_cascade_df1_f32(&lowpass, &filtered_emgT, &filtered_emgT, 1 ); + + //moving average + T0=filtered_emgT; + MOVAVG_T=T0*0.1+T1*0.1+T2*0.1+T3*0.1+T4*0.1+T5*0.1+T6*0.1+T7*0.1+T8*0.1+T9*0.1; + T9=T8; + T8=T7; + T7=T6; + T6=T5; + T5=T4; + T4=T3; + T3=T2; + T2=T1; + T1=T0; + + scope.set(0,emg_valueT); //ruwe data + scope.set(1,filtered_emgT); //filtered //naar scherm scope.set(2,emg_valueB); //ruwe data @@ -139,7 +167,7 @@ // *** MAIN *** int main() -{ +{ //bepaling van positie met triceps Ticker log_timerT; arm_biquad_cascade_df1_init_f32(&lowpass,1,lowpass_const,lowpass_states); @@ -148,7 +176,7 @@ log_timerT.attach(Triceps, 0.005); while(1) {} - drempelwaardeT1=4.99; + drempelwaardeT1=4; drempelwaardeT2=7; if (MOVAVG_T >= drempelwaardeT1) { yT1=1; @@ -175,8 +203,6 @@ } } } - - //bepaling van snelheidsstand met biceps Ticker log_timerB; arm_biquad_cascade_df1_init_f32(&lowpass,1,lowpass_const,lowpass_states); @@ -185,7 +211,7 @@ log_timerB.attach(Biceps, 0.005); while(1) {} - drempelwaardeB1=4.99; + drempelwaardeB1=4; drempelwaardeB2=6; drempelwaardeB3=10;