BlocosIA Wiki Editor

Line-following robot

Advanced · Build a track with the robot tileset and program a robot with two color sensors.

Interactive tutorial: the editor checks each step by itself.

  1. Add the "Game world" extension.
  2. In the World category, click "Open the map editor", then "Start with a robot track" and save.
  3. Add the "Robot and sensors" extension.
  4. Choose a sprite and click "Open the robot editor" (Robot category). Save the "Line follower" robot.
  5. Drag "when green flag clicked" with a "forever" below.
  6. Inside the "forever", put "if … then else" (Control) with "sensor left color sees black?" (Robot) as the condition.
  7. In "then", put "motors: left -20 % right 60 %"; in "else", "motors: left 60 % right -20 %".
  8. Move the robot onto the black line, point it up and click the flag!
  9. Challenge: use "when I pass start gate" and "last split time" to time the laps. (challenge)

Open in the editor