![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
emg
Dependencies: HIDScope MODSERIAL mbed-dsp mbed TouchButton
Fork of test by
Revision 48:b354afb564f2, committed 2014-10-29
- Comitter:
- Tanja2211
- Date:
- Wed Oct 29 09:33:18 2014 +0000
- Parent:
- 47:3bdc6a55abb6
- Commit message:
- AWESOME
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Oct 29 08:42:14 2014 +0000 +++ b/main.cpp Wed Oct 29 09:33:18 2014 +0000 @@ -84,7 +84,7 @@ filtered_emgT = fabs(filtered_emgT); //Triceps moving average - T0=filtered_emgT*100; + T0=filtered_emgT*1000; MOVAVG_T=T0*0.03333+T1*0.03333+T2*0.03333+T3*0.03333+T4*0.03333+T5*0.03333+T6*0.03333+T7*0.03333+T8*0.03333+T9*0.03333+T10*0.03333+T11*0.03333+T12*0.03333+T13*0.03333+T14*0.03333+T15*0.03333+T16*0.03333+T17*0.03333+T18*0.03333+T19*0.03333+T20*0.03333+T21*0.03333+T22*0.03333+T23*0.03333+T24*0.03333+T25*0.03333+T26*0.03333+T27*0.03333+T28*0.03333+T29*0.03333; T29=T28, T28=T27, T27=T26, T26=T25, T25=T24, T24=T23, T23=T22, T22=T21, T21=T20, T20=T19, T19=T18, T18=T17; T17=T16, T16=T15, T15=T14, T14=T13, T13=T12, T12=T11, T11=T10, T10=T9, T9=T8, T8=T7, T7=T6, T6=T5; @@ -144,7 +144,7 @@ arm_biquad_cascade_df1_init_f32(&highpassT,1,highpass_const,highpass_states); log_timerT.attach(Triceps, 0.005); - wait(3); + wait(2); log_timerT.detach(); } @@ -157,7 +157,7 @@ arm_biquad_cascade_df1_init_f32(&highpassB,1,highpass_const,highpass_states); log_timerB.attach(Biceps, 0.005); - wait(3); + wait(2); log_timerB.detach(); } @@ -316,45 +316,13 @@ myled3 = 1; log_timerT1.attach(Triceps, 0.005); - wait(5); + wait(3); log_timerT1.detach(); - MOVAVG_T=MOVAVG_Positie1; - // positie van batje met behulp van Triceps - if (MOVAVG_Positie1 >= drempelwaardeT) { + if (MOVAVG_T >= drempelwaardeT) { yT1=1; - - //bepaling van positie met tricep 2 - Ticker log_timerT2; - - arm_biquad_cascade_df1_init_f32(¬chT,1,notch_const,notch_states); - arm_biquad_cascade_df1_init_f32(&lowpassT,1,lowpass_const,lowpass_states); - arm_biquad_cascade_df1_init_f32(&highpassT,1,highpass_const,highpass_states); - - myled1 = 0; - myled2 = 1; - myled3 = 1; - - log_timerT2.attach(Triceps, 0.005); - wait(5); - log_timerT2.detach(); - - MOVAVG_T=MOVAVG_Positie2; - - if (MOVAVG_Positie2 >= drempelwaardeT) { - yT2=1; - } else { - yT2=0; - } - - pc.printf("Triceps meting 2 is klaar.\n"); - myled1 = 1; - myled2 = 1; - myled3 = 0; - wait(3); - } else { yT1=0; } @@ -365,7 +333,34 @@ myled3 = 0; wait(3); - + //bepaling van positie met tricep 2 + Ticker log_timerT2; + + arm_biquad_cascade_df1_init_f32(¬chT,1,notch_const,notch_states); + arm_biquad_cascade_df1_init_f32(&lowpassT,1,lowpass_const,lowpass_states); + arm_biquad_cascade_df1_init_f32(&highpassT,1,highpass_const,highpass_states); + + myled1 = 0; + myled2 = 1; + myled3 = 1; + + log_timerT2.attach(Triceps, 0.005); + wait(3); + log_timerT2.detach(); + + if (MOVAVG_T >= drempelwaardeT) { + yT2=1; + } else { + yT2=0; + } + + pc.printf("Triceps meting 2 is klaar.\n"); + myled1 = 1; + myled2 = 1; + myled3 = 0; + wait(3); + + //*** INPUT MOTOR 2 *** positie=yT1+yT2; @@ -382,7 +377,7 @@ } } - wait(5); + wait(2); Ticker log_timerB; @@ -395,7 +390,7 @@ myled3 = 1; log_timerB.attach(Biceps,0.005); - wait(5); + wait(3); log_timerB.detach(); //bepaling van snelheidsstand met biceps