31 lines
770 B
Python
31 lines
770 B
Python
from logique_BR import *
|
|
def main():
|
|
print("Démarrage")
|
|
sleep(1)
|
|
|
|
try:
|
|
while True:
|
|
if mesure_distance_cm() > 0:
|
|
avancer(100)
|
|
else:
|
|
moteurs_stop(0)
|
|
tourner_gauche(90)
|
|
if mesure_distance_cm()>0:
|
|
avancer(100)
|
|
else:
|
|
tourner_droite(180)
|
|
if mesure_distance_cm()>0:
|
|
avancer(100)
|
|
else:
|
|
tourner_droite(90)
|
|
avancer(100)
|
|
except KeyboardInterrupt:
|
|
moteurs_stop()
|
|
print("impossible d'avancer")
|
|
|
|
|
|
|
|
# Lancer automatiquement si ce fichier est main.py
|
|
if __name__ == "__main__":
|
|
main()
|