var param_vitesse = 100 var vitesse = 0 var tourne = 0 onevent rc5 if rc5.command == 1 then vitesse = abs(param_vitesse)/2 call leds.top(50,50,0) call leds.bottom.left(50,50,0) call leds.bottom.right(50,50,0) elseif rc5.command == 2 then vitesse = abs(param_vitesse) call leds.top(0,50,0) call leds.bottom.left(0,50,0) call leds.bottom.right(0,50,0) elseif rc5.command == 3 then vitesse = 2 * abs(param_vitesse) call leds.top(0,50,50) call leds.bottom.left(0,50,50) call leds.bottom.right(0,50,50) elseif rc5.command == 8 then vitesse = - abs(param_vitesse) call leds.top(0,0,50) call leds.bottom.left(0,0,50) call leds.bottom.right(0,0,50) elseif rc5.command == 5 then timer.period[0]=1 vitesse = 0 call leds.top(0,0,0) call leds.bottom.left(0,0,0) call leds.bottom.right(0,0,0) elseif rc5.command == 4 then tourne = 1 elseif rc5.command == 6 then tourne = 2 end onevent prox if (prox.ground.delta[1]<300 or prox.ground.delta[0]<300)and vitesse != 0 then timer.period[0]=1 vitesse = 0 call leds.top(50,0,0) call leds.bottom.left(50,0,0) call leds.bottom.right(50,0,0) call sound.system(5) end onevent timer0 if tourne ==1 then timer.period[0]=500 tourne = 0 motor.left.target = vitesse motor.right.target = 0 elseif tourne ==2 then timer.period[0]=500 tourne = 0 motor.left.target = 0 motor.right.target = vitesse else timer.period[0]=1 motor.left.target = vitesse motor.right.target = vitesse end