-
Notifications
You must be signed in to change notification settings - Fork 2
robot de compagnie
Hugo Ducommun edited this page Sep 20, 2018
·
25 revisions
Modifiez le comportement du robot de compagnie pour qu’il bouge en avant quand le programme est exécuté et qu’il s’arrête lorsqu’il détecte le bord de la table (ou une bande de ruban adhésif noir).
Le robot suit l'objet ou la main en fonction des capteurs à l'avant du Thymio. S'il détecte un bord de table, il s'arrête. Les leds du dessus indiquent son état. En rouge s'il est arrêté et en vert s'il fonctionne.
# reset outputs
call sound.system(-1)
call leds.top(0,0,0)
call leds.bottom.left(0,0,0)
call leds.bottom.right(0,0,0)
call leds.circle(0,0,0,0,0,0,0,0)
onevent prox
when prox.horizontal[2] >= 2000 do
motor.left.target = 200
motor.right.target = 200
call leds.top(0,32,0)
emit pair_run 0
end
when prox.horizontal[0] >= 2000 do
motor.left.target = -200
motor.right.target = 200
call leds.top(0,32,0)
emit pair_run 1
end
when prox.horizontal[4] >= 2000 do
motor.left.target = 200
motor.right.target = -200
call leds.top(0,32,0)
emit pair_run 2
end
when prox.ground.delta[0] <= 400 and prox.ground.delta[1] <= 400 do
motor.left.target = 0
motor.right.target = 0
call leds.top(32,0,0)
emit pair_run 3
end