Introduction: Eremote Thymio 2000

A remote controlled thymio robot. Base code used in purple mode with some of our own code added.

Step 1: Program the Remote

Materials:
OneForAll Universal Remote integration with Thymio Robot

How to program a remote to a thymio:

1. Set THYMIO to the pre-programmed PURPLE mode
2. Press and hold the SET button.
3. When the LED light flashes twice, press the buttons 1454.

Step 2: How to Use the Remote

If you can not insert the code or have no use for motion sensors, follow these guidlines. Note: with the code, you can also stop with 5.
4= turn left
6=turn right
2= go forward
8= reverse

When in action, press 8 to cancel actions, but when in reverse, press 2 to cancel actions

When pressing #s twice, action is accelerated.

Can have 2 running at same time (forward, left), or (forward, forward); meaning it just adds to the motor speed (to stop, press opposite of where it is, like (forward, back) or (left, right) or just press center button on robot.

Step 3: Program the Robot

Now connect the Thymio to your computer and insert this code: ( you can use the instructions on the page before or our movie)

<!DOCTYPE aesl-source>
<network>


<!--list of global events-->


<!--list of constants-->


<!--show keywords state-->
<keywords flag="true"/>


<!--node thymio-II-->
<node name="thymio-II">var temp
var rc5_speed_l
var rc5_speed_t
var vmin=-600
var vmax=600

var led_pulse

timer.period[0]=20

sub setmotor
call math.min(rc5_speed_t, rc5_speed_t, vmax)
call math.max(rc5_speed_t, rc5_speed_t, vmin)
call math.min(rc5_speed_l, rc5_speed_l, vmax)
call math.max(rc5_speed_l, rc5_speed_l, vmin)
motor.left.target  = rc5_speed_l + rc5_speed_t
motor.right.target  = rc5_speed_l - rc5_speed_t


onevent button.left
if button.left==1 then
  rc5_speed_t = -200
end
callsub setmotor

onevent button.right
if button.right==1 then
  rc5_speed_t = 200
end
callsub setmotor

onevent button.center
if button.center==1 then
  rc5_speed_t=0
  rc5_speed_l=0
end
callsub setmotor

onevent button.backward
if button.backward==1 then
  if rc5_speed_t !=0 then
   rc5_speed_t = 0
  else
   rc5_speed_l = rc5_speed_l-200
  end
end
callsub setmotor

onevent button.forward
if button.forward==1 then
  if rc5_speed_t !=0 then
   rc5_speed_t = 0
  else
   rc5_speed_l = rc5_speed_l+200
  end
end
callsub setmotor

onevent buttons
when button.backward==1 and button.forward==1 do
  rc5_speed_l = 0
end
when button.right==1 and button.left==1 do
  rc5_speed_t = 0
end
callsub setmotor


onevent timer0
#Body color pulse
led_pulse = led_pulse + 1
if led_pulse > 0 then
  call leds.top(led_pulse,0 , led_pulse)
  if led_pulse > 40 then
   led_pulse = -64
  end
else
temp=-led_pulse/2
call leds.top(temp, 0, temp)
end


onevent rc5
if rc5.command !=0 then
  if rc5.command == 2 then
    if rc5_speed_t!=0 then
     rc5_speed_t = 0
    else
     rc5_speed_l = rc5_speed_l+200
    end    
  elseif rc5.command == 4 then
    rc5_speed_t = -200  
  elseif rc5.command == 8 then
    if rc5_speed_t!=0 then
     rc5_speed_t = 0
    else
     rc5_speed_l = rc5_speed_l-200
    end
  elseif rc5.command == 6 then
    rc5_speed_t = 200
  elseif rc5.command == 5 then
    rc5_speed_t = 0
    rc5_speed_l = 0
  end
  rc5.command = 0
end
onevent prox
call sound.system(-1)
call leds.temperature(0,0)
call leds.top(0,0,0)
call leds.circle(0,0,0,0,0,0,0,0)

if prox.horizontal[2] > 3000 and rc5_speed_l > 0 then
  rc5_speed_l = 0
end
if  prox.horizontal[0] > 1500 and prox.horizontal[6] &lt; 1000 and rc5_speed_l > 0 then rc5_speed_t = 300
end
if  prox.horizontal[6] > 1500 and prox.horizontal[0] &lt; 1000 and rc5_speed_l > 0 then rc5_speed_t = -300
end</node>


</network>

Step 4: Eremote Comercial

Now here is our little comercial to show you how it works: