Base 5aakt
PARTIE GENIE ELECTRIQUE

 Réalisation de la programmation :

  • Pour les capteurs activés, le robot avance:

 

      ' 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

     

  •   Pour les deux capteurs séparément ,contournement d'obstacles:

 

' 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                            avancer

   end if                                  fin si

   if PORTE.1=0 then                       si capteur gauche actif alors

   for t3=1 to 100                         pour 2 sec

   gosub recule                            reculer

   next t3

   for t3=1 to 40                          pour 1 sec

   gosub droite                            tourner droite

   next t3

   for t3=1 to 150                         pour 3 sec

   gosub avance                            avancer

   next t3

   for t3=1 to 40                          pour 1 sec

   gosub gauche                            tourner gauche

   next t3

   end if                                  fin si

   if PORTE.3=0 then                       si capteur droit actif alors

   for t3=1 to 100                         pour 2 sec

   gosub recule                            reculer

   next t3

   for t3=1 to 40                          pour 1 sec

   gosub gauche                            tourner gauche

   next t3

   for t3=1 to 150                         pour 3 sec

   gosub avance                            avancer

   next t3

   for t3=1 to 40                         pour 1 sec

   gosub droite                           tourner droite

   next t3

   end if                                 fin si

   loop                                   toujours

  •     Pour les capteurs infrarouges:

 

 

   do                                     répéter

   if PORTE.1=1 and PORTE.3=1 then        si capteur droit et capteur gauche désactivé alors

   gosub avance                           avancer

   end if                                 fin si

   readirs()                              la procédure de lecture des capteurs infrarouges

   IF irl< 8 and irr< 8 then '            Obstacle droit devant

   print "#0 "                            ne rien afficher

   else                                   sinon

   print "#0 obstacle "                   afficher obstacle

   end if                                 fin si

   if PORTE.1=0 or irl<8 then             si 1 capteur gauche actif alors

   for t3=1 to 100                        pour 2 sec

   gosub recule                           reculer

   next t3

   for t3=1 to 40                         pour 1 sec

   gosub droite                           tourner droite

   next t3

   for t3=1 to 150                        pour 3 sec

   gosub avance                           avancer

   next t3

   for t3=1 to 40                        pour 1 sec

   gosub gauche                          tourner gauche

   next t3

   end if                                fin si

   if PORTE.3=0 or irr<8 then            si 1 capteur droit actif

   for t3=1 to 100                       pour 2 sec   

   gosub recule                          reculer

   next t3

   for t3=1 to 40                        pour 1 sec

   gosub gauche                          tourner gauche

   next t3

   for t3=1 to 150                       pour 3 sec

   gosub avance                          avancer

   next t3

   for t3=1 to 40                        pour 1 sec

   gosub droite                          tourner droite

   next t3

   end if                                fin si

   loop                                  toujours

  •                      Routine de base:

 

' 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

 

'

 

 

Sommaire du projet