You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to setup the Thymio so that the kids can "program" the Thymio with the arrow buttons and start there programm onevent button.center. Input example:
<
^
v
^
o
But the Thymio is just executing the last input, no matter hier I make use of the timer...
But my array doesn't work as expected. The robot should drive one command after the other, instead of just executing the last command in the array.
How do I have to fix it?
var go[5] = [0,0,0,0,0]
var j = 0
var i
var i2 = 0
var richtung
# stop timer 0
# timer.period[0] = 0
# 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 button.center
when button.center == 1 do
while i < 5 do
if go[i] == 0 then
call leds.circle(32,0,0,0,0,0,0,0)
motor.left.target = 300
motor.right.target = 300
elseif go[i] == 1 then
call leds.circle(0,0,32,0,0,0,0,0)
motor.left.target = 300
motor.right.target = 0
elseif go[i] == 2 then
call leds.circle(0,0,0,0,32,0,0,0)
motor.left.target = -300
motor.right.target = -300
#timer.period[0] = 1000
elseif go[i] == 3 then
call leds.circle(0,0,0,0,0,0,32,0)
motor.left.target = 0
motor.right.target = 300
end
i = i + 1
end
#emit pair_run 5
end
onevent button.forward
when button.forward == 1 do
richtung = 0
go[i2] = 0
i2 = i2 + 1
#emit pair_run 0
end
onevent button.right
when button.right == 1 do
richtung = 1
go[i2] = richtung
i2 = i2 + 1
end
onevent button.left
when button.left == 1 do
richtung = 3
go[i2] = richtung
i2 = i2 + 1
#emit pair_run 2
end
onevent button.backward
when button.backward == 1 do
richtung = 2
go[i2] = richtung
i2 = i2 + 1
#emit pair_run 3
end
onevent timer0
timer.period[0] = 0
motor.left.target = 0
motor.right.target = 0
call leds.bottom.left(32,0,0)
call leds.bottom.right(32,0,0)
The text was updated successfully, but these errors were encountered:
But I can hardly figure out, how I could make use of it properly...could you please give me more hints, how to handle my problem with deqeue? And how can I know, wether my Thymios have the dequeuelibrary or not?
I try to setup the Thymio so that the kids can "program" the Thymio with the arrow buttons and start there programm
onevent button.center
. Input example:<
^
v
^
o
But the Thymio is just executing the last input, no matter hier I make use of the timer...
But my array doesn't work as expected. The robot should drive one command after the other, instead of just executing the last command in the array.
How do I have to fix it?
The text was updated successfully, but these errors were encountered: