|
Base 5aakt PARTIE GENIE ELECTRIQUE |
|
Réalisation de la programmation :
' Boucle principale
do répéter if PORTE.1=1 and PORTE.3=1 then si capteur gauche et capteur droit désactivé alors gosub avance alors avancer end if fin si loop toujours
' Boucle principale do répéterif PORTE.1=1 and PORTE.3=1 then si capteur gauche et capteur droit désactivé,alorsgosub avance avancerend if fin siif PORTE.1=0 then si capteur gauche actif alorsfor t3=1 to 100 pour 2 secgosub recule reculernext t3 for t3=1 to 40 pour 1 secgosub droite tourner droitenext t3 for t3=1 to 150 pour 3 secgosub avance avancernext t3 for t3=1 to 40 pour 1 secgosub gauche tourner gauchenext t3 end if fin siif PORTE.3=0 then si capteur droit actif alorsfor t3=1 to 100 pour 2 secgosub recule reculernext t3 for t3=1 to 40 pour 1 secgosub gauche tourner gauchenext t3 for t3=1 to 150 pour 3 secgosub avance avancernext t3 for t3=1 to 40 pour 1 secgosub droite tourner droitenext t3 end if fin siloop toujours
do répéterif PORTE.1=1 and PORTE.3=1 then si capteur droit et capteur gauche désactivé alorsgosub avance avancerend if fin sireadirs() la procédure de lecture des capteurs infrarougesIF irl< 8 and irr< 8 then ' Obstacle droit devantprint "#0 " ne rien afficherelse sinonprint "#0 obstacle " afficher obstacleend if fin siif PORTE.1=0 or irl<8 then si 1 capteur gauche actif alorsfor t3=1 to 100 pour 2 secgosub recule reculernext t3 for t3=1 to 40 pour 1 secgosub droite tourner droitenext t3 for t3=1 to 150 pour 3 secgosub avance avancernext t3 for t3=1 to 40 pour 1 secgosub gauche tourner gauchenext t3 end if fin siif PORTE.3=0 or irr<8 then si 1 capteur droit actiffor t3=1 to 100 pour 2 secgosub recule reculernext t3 for t3=1 to 40 pour 1 secgosub gauche tourner gauchenext t3 for t3=1 to 150 pour 3 secgosub avance avancernext t3 for t3=1 to 40 pour 1 secgosub droite tourner droitenext t3 end if fin siloop toujours
' Boucle principale do répéterif PORTE.1=1 and PORTE.3=1 then si capteur gauche et capteur droitdésactivé alorsgosub avance alors avancerend if fin siloop toujours
'
|