Thymio Caution Bot!

by woodlandtech in Circuits > Robots

1411 Views, 2 Favorites, 0 Comments

Thymio Caution Bot!

IMG_5085.jpg
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 One: Gather the Legos for Part One

IMG_5069.jpg
Gather the Following Legos you see in the picture 

Legos Added

IMG_5075.jpg
Put your legos in the spots show in the picture. 

Add the Following Legos

IMG_5081.jpg
IMG_5087.jpg
This includes an image of the final thymio, and the legos needed to finish it. 

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

Test the Robot!!