Skip to content
heleneardevol edited this page Sep 20, 2018 · 10 revisions

Timide

Le but de cet exercice est de mettre votre Thymio en mode "timide" a l'aide du programme VPL

Thymio timide

Code

# 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[0] >= 2000 and prox.horizontal[1] >= 2000 do
		motor.left.target = 300
		motor.right.target = 0
		emit pair_run 0
	end

	when prox.horizontal[3] >= 2000 and prox.horizontal[4] >= 2000 do
		motor.left.target = 0
		motor.right.target = 250
		emit pair_run 1
	end

	when prox.horizontal[2] >= 2000 do
		motor.left.target = -250
		motor.right.target = -250
		emit pair_run 2
	end

	when prox.horizontal[5] >= 2000 and prox.horizontal[6] >= 2000 do
		motor.left.target = 250
		motor.right.target = 250
		emit pair_run 3
	end

Clone this wiki locally