v5
Dependencies: MODSERIAL TextLCD mbed
Revision 2:b9a7fafd233c, committed 2013-11-05
- Comitter:
- bouvdberg
- Date:
- Tue Nov 05 10:58:48 2013 +0000
- Parent:
- 1:c18c171bf8b4
- Commit message:
- V6
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r c18c171bf8b4 -r b9a7fafd233c main.cpp --- a/main.cpp Tue Nov 05 10:14:49 2013 +0000 +++ b/main.cpp Tue Nov 05 10:58:48 2013 +0000 @@ -26,14 +26,14 @@ #define LP1 0.9868 #define LP2 0.01325 //EMG threshold -#define SET_EMG_MAX1 3.8 //bovenarm rechts > beweging naar rechts -#define SET_EMG_MIN1 2.3 -#define SET_EMG_MAX2 3.8 //bovenarm links > beweging naar links -#define SET_EMG_MIN2 0.7 -#define SET_EMG_MAX3 7.2 //onderarm rechts > beweging naar boven -#define SET_EMG_MIN3 2.6 -#define SET_EMG_MAX4 1.8 //onderarm links > beweging naar onder -#define SET_EMG_MIN4 0.8 +#define SET_EMG_MAX1 2.7 //bovenarm rechts > beweging naar rechts +#define SET_EMG_MIN1 1.9 +#define SET_EMG_MAX2 2.7 //bovenarm links > beweging naar links +#define SET_EMG_MIN2 1.7 +#define SET_EMG_MAX3 3.0 //onderarm rechts > beweging naar boven +#define SET_EMG_MIN3 1.5 +#define SET_EMG_MAX4 6.0 //onderarm links > beweging naar onder +#define SET_EMG_MIN4 1.0 void aansturing(void); void uitzetten(void); @@ -362,7 +362,7 @@ if (ButtonDOWN.read()==1) //Misschien in de loop van 'aansturing' zetten???????????????????? { t_sol++; - if (t_sol>10) + if (t_sol>25) { if (sol_updown==0) { @@ -482,10 +482,10 @@ if (EMGlp4 > CAL_EMG4_MAX) CAL_EMG4_MAX=EMGlp4; } - EMGmin1= CAL_EMG1_MAX+0.15; - EMGmin2= CAL_EMG2_MAX+0.15; - EMGmin3= CAL_EMG3_MAX+0.15; - EMGmin4= CAL_EMG4_MAX+0.15; + EMGmin1= CAL_EMG1_MAX+0.35; + EMGmin2= CAL_EMG2_MAX+0.35; + EMGmin3= CAL_EMG3_MAX+0.35; + EMGmin4= CAL_EMG4_MAX+0.35; emg_value1min1=0.5; emg_value2min1=0.5; emg_value3min1=0.5; @@ -666,7 +666,7 @@ emg_value4min1=0.5; EMGhp4min1=0.5; EMGlp4min1=0.5; - if ((EMGmax1-EMGmin1)<0.8 || (EMGmax2-EMGmin2)<0.8 || (EMGmax3-EMGmin3)<0.8 || (EMGmax4-EMGmin4)<0.8) + if ((EMGmax1-EMGmin1)<0.6 || (EMGmax2-EMGmin2)<0.6 || (EMGmax3-EMGmin3)<0.6 || (EMGmax4-EMGmin4)<0.6) { lcd.cls(); lcd.printf("Calibration ..."); @@ -680,7 +680,7 @@ lcd.cls(); lcd.printf("Calibration ..."); lcd.locate(0,1); - lcd.printf("Done! Data Saved!"); + lcd.printf("Done! Data Saved"); wait(1); menu=0; @@ -743,10 +743,10 @@ //t_timer=t_timer+LOOPTIME; - //pc.printf("%.2f ",v1); - //pc.printf("%.2f ",v2); - //pc.printf("%.2f ",v3); - //pc.printf("%.2f ",v4); + pc.printf("%.2f ",v1); + pc.printf("%.2f ",v2); + pc.printf("%.2f ",v3); + pc.printf("%.2f ",v4); if(v1<=0.0 && v2<=0.0 && v3<=0.0 && v4<=0.0) { Solenoid=1; //Pen van papier input=0.0; @@ -951,7 +951,7 @@ Brake1=0; Brake2=0; i_timer=300; - while(BeginM1 - motor1.getPosition() >= 10 || BeginM1 - motor1.getPosition() <= -10 || BeginM2 - motor2.getPosition() >= 10 || BeginM2 - motor2.getPosition() <= -10 || motor1.getSpeed()>=20 || motor2.getSpeed()>=20) + while(BeginM1 - motor1.getPosition() >= 5 || BeginM1 - motor1.getPosition() <= -5 || BeginM2 - motor2.getPosition() >= 5 || BeginM2 - motor2.getPosition() <= -5 || motor1.getSpeed()>=20 || motor2.getSpeed()>=20) { Ticker looptimer; looptimer.attach(setlooptimerflag,LOOPTIME); @@ -959,7 +959,7 @@ looptimerflag = false; M1position=motor1.getPosition(); M2position=motor2.getPosition(); - pwm_to_motor1 = (BeginM1 - M1position)*.008; + pwm_to_motor1 = (BeginM1 - M1position)*.012; pwm_to_motor2 = (BeginM2 - M2position)*.008; keep_in_range(&pwm_to_motor1, -0.05,0.05); if(pwm_to_motor1 > 0)