hkb
Dependencies: Encoder_Nucleo_16_bits PwmIn mbed
Fork of TestBoardv2_boussole_pixi by
Revision 9:7584e3904be6, committed 2017-06-09
- Comitter:
- Cachan1
- Date:
- Fri Jun 09 11:14:04 2017 +0000
- Parent:
- 8:527f5db9b3dc
- Commit message:
- jnpj;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 527f5db9b3dc -r 7584e3904be6 main.cpp --- a/main.cpp Fri Jun 09 02:09:09 2017 +0000 +++ b/main.cpp Fri Jun 09 11:14:04 2017 +0000 @@ -452,7 +452,7 @@ int main() { - int i = 0, val_H_balle = 0, val_W_balle=0, max_val_W_balle = 0, indice_balle = 0, val_carre_balle=0, val_x_balle=0; + int i = 0, val_H_balle = 0, val_W_balle=0, max_val_W_balle = 0, indice_balle = 0, val_carre_balle=0, val_x_balle=0, A=1; Byte PIXY_rCCObjet = 0, PIXY_rNMObjet = 0; int PIXY_objet; @@ -548,7 +548,14 @@ Pc.printf ("\rAppuyez sur Entree pour quitter\n"); do { - capteur_ultrason(); + if(CNY1>0.5 && A==1) { + avancer(); + } + else + { + En = 0; + A=0; + } } while(!Pc.readable()); MENU_choix = Pc.getc(); @@ -584,7 +591,7 @@ { tour_droit(); } - else if(CAP_PWM>200) + else if(CAP_PWM>230) { tour_gauche(); } @@ -791,6 +798,7 @@ if(val_W_balle>max_val_W_balle){ max_val_W_balle=val_W_balle; indice_balle=i; + } if(val_x_balle>130 && val_x_balle<170){ avancer(); } @@ -798,7 +806,7 @@ En = 0; } - } + } Pc.printf("\rNMobj sig = %hd : X=%5hd,Y=%5hd (W=%5hd, H=%5hd)\n",Pixy_NMFIFO[indice_balle].NMbloc.signature,Pixy_NMFIFO[indice_balle].NMbloc.x,Pixy_NMFIFO[indice_balle].NMbloc.y,Pixy_NMFIFO[indice_balle].NMbloc.width,Pixy_NMFIFO[indice_balle].NMbloc.height); @@ -992,11 +1000,9 @@ En = 1; SensD = 1; Led2 = 1; - MOTD_duty = 0.48; - Pwm_MD = 0.5; + MOTD_duty = 0.2; SensG = 0; - MOTG_duty = 0.5; - Pwm_MG = 0.5; + MOTG_duty = 0.87; Pwm_MG = MOTG_duty; Pwm_MD = MOTD_duty; @@ -1007,10 +1013,10 @@ SensD = 0; Led2 = 1; MOTD_duty = 0.5; - Pwm_MD = 0.5; + Pwm_MD = 0.3; SensG = 0; MOTG_duty = 0.5; - Pwm_MG = 0.5; + Pwm_MG = 0.3; Pwm_MG = MOTG_duty; Pwm_MD = MOTD_duty;