![](/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:
- 16:e997a6fd802a
- Parent:
- 15:e779bfbeb8ea
- Child:
- 17:5fd768d0504f
--- a/main.cpp Fri Oct 24 08:08:03 2014 +0000 +++ b/main.cpp Fri Oct 24 09:48:05 2014 +0000 @@ -34,13 +34,13 @@ arm_biquad_casd_df1_inst_f32 lowpassT; arm_biquad_casd_df1_inst_f32 lowpassB; //constants for 50Hz lowpass -float lowpass_const[] = {0.2928920553, 0.5857841107, 0.2928920554, 0, 0.17156822136};//{a0 a1 a2 --b1 --b2} van online calculator +float lowpass_const[] = {0, 0.558697707784438, 0.257307012382698, -0.292447944767337, 0.108452664934473};//{a0 a1 a2 -b1 -b2} van online calculator float lowpass_states[4]; arm_biquad_casd_df1_inst_f32 highpassT; arm_biquad_casd_df1_inst_f32 highpassB; //constants for 10Hz highpass -float highpass_const[] = {0.8005910267, -1.6011820533, 0.8005910267, -1.5610153913, 0.6413487154};//{a0 a1 a2 --b1 --b2} +float highpass_const[] = {1.000000000000000, -1.957555609146701, 0.957555609146701, -1.562244197866329, 0.641280516968023};//{a0 a1 a2 -b1 -b2} float highpass_states[4]; @@ -56,8 +56,7 @@ arm_biquad_cascade_df1_f32(&lowpassT, &filtered_emgT, &filtered_emgT, 1 ); filtered_emgT = fabs(filtered_emgT); - //sturen naar scherm (Realterm) - pc.printf("%f\r\n",filtered_emgT); + //Triceps moving average T0=filtered_emgT; @@ -90,6 +89,10 @@ T3=T2; T2=T1; T1=T0; + + //sturen naar scherm (Realterm) + pc.printf("%f\r\n",MOVAVG_T); + //sturen naar HID Scope scope.set(0,emg_valueT); //ruwe data @@ -108,9 +111,6 @@ arm_biquad_cascade_df1_f32(&lowpassB, &filtered_emgB, &filtered_emgB, 1 ); filtered_emgB = fabs(filtered_emgB); - //sturen naar scherm - pc.printf("%f\r\n",filtered_emgB); - //Biceps moving average B0=filtered_emgB; MOVAVG_B=B0*0.03333+B1*0.03333+B2*0.03333+B3*0.03333+B4*0.03333+B5*0.03333+B6*0.03333+B7*0.03333+B8*0.03333+B9*0.03333+B10*0.03333+B11*0.03333+B12*0.03333+B13*0.03333+B14*0.03333+B15*0.03333+B16*0.03333+B17*0.03333+B18*0.03333+B19*0.03333+B20*0.03333+B21*0.03333+B22*0.03333+B23*0.03333+B24*0.03333+B25*0.03333+B26*0.03333+B27*0.03333+B28*0.03333+B29*0.03333; @@ -143,6 +143,9 @@ B2=B1; B1=B0; +//sturen naar scherm + pc.printf("%f\r\n",MOVAVG_B); + //naar HID Scope scope.set(2,emg_valueB); //ruwe data scope.set(3,filtered_emgB); //filtered @@ -160,7 +163,7 @@ arm_biquad_cascade_df1_init_f32(&highpassT,1,highpass_const,highpass_states); log_timerT1.attach(Triceps, 0.005); - wait(60); //log_timerT wordt 2000 keer uitgevoerd + wait(30); //log_timerT wordt 2000 keer uitgevoerd log_timerT1.detach(); MOVAVG_T=MOVAVG_Positie1; @@ -169,7 +172,7 @@ Ticker log_timerT2; log_timerT2.attach(Triceps, 0.005); - wait(60); + wait(30); log_timerT2.detach(); MOVAVG_T=MOVAVG_Positie2; @@ -212,7 +215,7 @@ arm_biquad_cascade_df1_init_f32(&highpassB,1,highpass_const,highpass_states); log_timerB.attach(Biceps,0.005); - wait(60);//log_timerB wordt 2000 keer uitgevoerd + wait(30);//log_timerB wordt 2000 keer uitgevoerd log_timerB.detach(); //bepaling van snelheidsstand met biceps