Introduction: Thymio Caution Bot!
The Thymio caution bot, is a robot that stops and starts based on it's surroundings. If it can't go because of an obstacle it will turn red and make loud noises to alert you. If it an go it goes at a fast speed and turns blue.
Step 1: Step One: Gather the Legos for Part One
Gather the Following Legos you see in the picture
Step 2: Legos Added
Put your legos in the spots show in the picture.
Step 3: Add the Following Legos
This includes an image of the final thymio, and the legos needed to finish it.
Step 4: Program!!
Time to program thymio. Use this code.
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)
onevent prox
if prox.horizontal[5] < 400 and prox.horizontal[6] < 400 then
motor.left.target = 0
motor.right.target = 0
end
if prox.horizontal[2] < 400 then
motor.left.target = 0
motor.right.target = 0
end
if prox.horizontal[0] < 400 and prox.horizontal[1] < 400 and prox.horizontal[3] < 400 and prox.horizontal[4] < 400 then
motor.left.target = 500
motor.right.target = 500
end
if prox.ground.reflected[0] < 150 and prox.ground.reflected[1] < 150 then
call leds.top(32,0,0)
end
if prox.ground.reflected[0] < 150 and prox.ground.reflected[1] < 150 then
call sound.system(4)
end
if prox.horizontal[0] < 400 and prox.horizontal[1] < 400 and prox.horizontal[2] < 400 and prox.horizontal[3] < 400 and prox.horizontal[4] < 400 and prox.horizontal[5] < 400 and prox.horizontal[6] < 400 then
call leds.top(0,0,32)
end
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)
onevent prox
if prox.horizontal[5] < 400 and prox.horizontal[6] < 400 then
motor.left.target = 0
motor.right.target = 0
end
if prox.horizontal[2] < 400 then
motor.left.target = 0
motor.right.target = 0
end
if prox.horizontal[0] < 400 and prox.horizontal[1] < 400 and prox.horizontal[3] < 400 and prox.horizontal[4] < 400 then
motor.left.target = 500
motor.right.target = 500
end
if prox.ground.reflected[0] < 150 and prox.ground.reflected[1] < 150 then
call leds.top(32,0,0)
end
if prox.ground.reflected[0] < 150 and prox.ground.reflected[1] < 150 then
call sound.system(4)
end
if prox.horizontal[0] < 400 and prox.horizontal[1] < 400 and prox.horizontal[2] < 400 and prox.horizontal[3] < 400 and prox.horizontal[4] < 400 and prox.horizontal[5] < 400 and prox.horizontal[6] < 400 then
call leds.top(0,0,32)
end