Find the right line!


It's easy to win a car race. Mostly, you just have to be the fastest and stay in your racing lane.

Would it help if you could follow a line?

Build this Driving Base with a Colour Sensor.


Let’s do this!

Drive and stop at a line.

SPIKE Competition Ready Training camp 3 Step03-Program - en-au

Try the first programming stack and describe what you see.

This first stack will make the Driving Base stop at a line that’s perpendicular to its movement.

The line can be:

  • A black line drawn on a piece of paper
  • Black tape
  • Larger black LEGO bricks

Drive on a line.


Try the second programming stack and describe what you see.  

If the Colour Sensor detects the edge of the black line, the Driving Base turns in the direction of the white space.

When the Colour Sensor does not detect the edge of the black line, the Driving Base turns in the opposite direction of the black line.

Repeat these 2 actions forever.


Maybe you have noticed that we are steering the motors at a right 50 and a left -50. Do you know why?

It is necessary for the movement along the line to have one motor moving and the other motor stopped to allow the Driving Base to move forward. If the Driving Base turns too sharply, it will just turn back and forth in place.

Optimise your program for speed.


There are many ways to make a fast line-follower.

Organise a race to see whose Driving Base can go the fastest!

Add an ’IF / ELSE’ Block to speed up the execution of the program.

Keep exploring line-follower programs, you’ll be surprised how much you can improve your speed!

Your program could look something like this:

SPIKE Competition Ready Training camp 3 Step05-Hint - en-au

How did you do?


What did you do well? Was there anything that you could have done better?

Brilliant! Now you should be able to move your Driving Base to almost anywhere on a playing field.