![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
4 directional EMG control of the XY table. Made during my bachelor end assignment.
Dependencies: C12832_lcd HIDScope mbed-dsp mbed
Diff: main.cpp
- Revision:
- 63:e336c16c8957
- Parent:
- 62:509622cce1c6
- Child:
- 64:5a66361c8318
diff -r 509622cce1c6 -r e336c16c8957 main.cpp --- a/main.cpp Wed Jun 17 14:54:59 2015 +0000 +++ b/main.cpp Wed Jun 17 15:05:25 2015 +0000 @@ -26,7 +26,7 @@ #define EMG_tresh3 0.01 #define EMG_tresh4 0.01 #define H_Gain 2 -#define Pt_x 0.83 +#define Pt_x 0.88 #define Pt_y 0.25 //Motor control @@ -223,25 +223,26 @@ Stepx.write(0.5); // Duty cycle of 50% Stepy.write(0.5); //Stepx.period(1/1500); + //wait(0.01); //Stepy.period(1/1500); //wait(0.01); //} - //Enablex = 1; - //Enabley = 1; - + Enablex = 1; + Enabley = 1; + wait(1); lcd.printf("Start homing"); wait(2); lcd.cls(); wait(1); Enablex = 0; Enabley = 0; - while(errorx > 0.05 && errory > 0.05) { + while(errorx > 0.03 || errory > 0.03) { lcd.printf("%.2f %.2f \n", Ps_x, Ps_y); Ps_x = Posx.read(); Ps_y = Posy.read(); - if (Ps_x < 0.83) { + if (Ps_x < 0.88) { Dirx = 0; errorx = Pt_x - Ps_x; cx = errorx * H_Gain; @@ -270,7 +271,7 @@ lcd.printf("Done"); Enablex = 1; Enabley = 1; - wai(3); + wait(3); /*Ticker emgtimer; //biceps arm_biquad_cascade_df1_init_f32(&lowpass_biceps, 1 , lowpass_const, lowpass_biceps_states); arm_biquad_cascade_df1_init_f32(&highnotch_biceps, 2 , highnotch_const, highnotch_biceps_states);