maj
This commit is contained in:
30
base_roulante/base_roulante.py
Normal file
30
base_roulante/base_roulante.py
Normal file
@@ -0,0 +1,30 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user