Browse Source

ralentit obstacle

master
chataigner.g 2 years ago
parent
commit
bdb9cdd86d
  1. 27
      main.py

27
main.py

@ -117,4 +117,29 @@ def lectension():
lecture = ldr.read() lecture = ldr.read()
tension = (lecture*3.3)/4095 tension = (lecture*3.3)/4095
pyb.delay(100) pyb.delay(100)
return tension return tension
#15 speed min
def allSpeed(speed):
h1.forward(speed)
h2.forward(speed)
def vitesse():
if dist_obstacle() < 5:
speed = 0
elif dist_obstacle() < 15:
speed = 15
elif dist_obstacle() < 25:
speed = 20
elif dist_obstacle() < 40:
speed = 35
else:
speed = 50
if 50 > x+5:
speed = 0
return speed
while True:
allSpeed(vitesse())
Loading…
Cancel
Save