DIM VALEUR_GP2D02_1 As Byte DIM VALEUR_GP2D02_2 As Byte DIM VALEUR_GP2D02_3 As Byte ;****************************************************** ;****************************************************** ;*** récupère les valeurs issus des 3 télémètrse IR *** ;****************************************************** ;****************************************************** '*** test du gp2D02 N°1 test_gp2d02_1: SHIFTOUT 26,18,0,&HB gosub Gestion_erreur_I²C gosub Recup_valeur_gp2d02_x return '*** test du gp2D02 N°2 test_gp2d02_2: SHIFTOUT 26,18,0,&HC gosub Gestion_erreur_I²C gosub Recup_valeur_gp2d02_x return '*** test du gp2D02 N°3 test_gp2d02_3: SHIFTOUT 26,18,0,&HD gosub Gestion_erreur_I²C gosub Recup_valeur_gp2d02_x return '*** fct commune aux 3 fcts de récup des valeurs gp2d02 Recup_valeur_gp2d02_x: DISTANCE_OBSTACLE = 0 If Indic_Gestion_erreur = 0 then deb_Recup_valeur_gp2d02_x: VALEUR_GP2D02_1 = IN(27) if VALEUR_GP2D02_1 = 0 Then goto deb_Recup_valeur_gp2d02_x end if DISTANCE_OBSTACLE = SHIFTIN(26,27,0) out 26,0 GOSUB Convertion_Distance delay 1000 End If return '*** Convertion de la distance Convertion_Distance: bcle_Mesure_Distance: I_Rech_Tele = I_Rech_Tele + 1 I_Rech_TeleSup = I_Rech_Tele + 1 If CORRESPONDANCE_TELEMETRE(I_Rech_Tele) = DISTANCE_OBSTACLE Then I = I_Rech_Tele goto fin_bcle_mesure ElseIf CORRESPONDANCE_TELEMETRE(I_Rech_Tele) > DISTANCE_OBSTACLE AND CORRESPONDANCE_TELEMETRE(I_Rech_TeleSup) < DISTANCE_OBSTACLE Then I = I_Rech_Tele goto fin_bcle_mesure ElseIf I_Rech_TeleSup = 62 Then goto fin_bcle_mesure Else goto bcle_Mesure_Distance End If fin_bcle_mesure: If I = 0 Then AFF_CHAR = "Pas d'obstacle "+Dec(I,3,1) Gosub AFFICHER_LCD Else AFF_CHAR = "Obstacle a:" + Dec(I,3,1) + "cm" Gosub AFFICHER_LCD End If Return