Pixy ok
Dependencies: Encoder_Nucleo_32_bits PwmIn mbed
Fork of v1 by
Revision 5:2aa5c36ced8f, committed 2017-06-09
- Comitter:
- Cachan1
- Date:
- Fri Jun 09 08:52:48 2017 +0000
- Parent:
- 4:f65b0905e4ce
- Commit message:
- Pixy ok
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f65b0905e4ce -r 2aa5c36ced8f main.cpp --- a/main.cpp Wed May 31 10:10:56 2017 +0000 +++ b/main.cpp Fri Jun 09 08:52:48 2017 +0000 @@ -396,7 +396,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 I2C_check = -1, BOUSSOLE_check = -1 /*, SPI2_check = -1, SPI3_check = -1, MOTG_check = -1, MOTD_check = -1*/; Byte PIXY_rCCObjet = 0, PIXY_rNMObjet = 0; @@ -737,9 +737,40 @@ if (PIXY_rCCObjet<19) PIXY_rCCObjet++; else PIXY_rCCObjet = 0; } + val_W_balle = 0; + val_H_balle = 0; + val_carre_balle = 0; + max_val_W_balle = 0; + indice_balle = 0; + for(i=0;i<14;i++){ + val_W_balle=Pixy_NMFIFO[i].NMbloc.width; + val_H_balle=Pixy_NMFIFO[i].NMbloc.height; + + val_carre_balle = val_H_balle/val_W_balle; + + val_x_balle =Pixy_NMFIFO[i].NMbloc.x; + + + 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){ + En = 1; + Pwm_MG=0.6; + Pwm_MD=0.6; + } + else{ + 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); + Pixy_CCObjet = 0; Pc.printf("\n\r"); FlagPixy = 0; + wait_ms(500); } if (FlagTickLed) {