Micromelon Robotics
Platform
Resources
NewsAbout UsDownload
Support
Build Your Kit

Stay in the loop

New activities, teaching guides, and product updates delivered to your inbox.

Micromelon Robotics

Australian-made educational robotics for the next generation of innovators.

contact@micromelon.com.au

Company

  • About Us
  • Privacy Policy
  • Terms and Conditions

Products

  • Micromelon Rover
  • Code Editor
  • Robot Simulator
  • Junior
  • Python Library

Support

  • Resources
  • News
  • Rover Repairs
  • Contact
  • Build Your Kit

© 2026 Micromelon Robotics Pty Ltd. All rights reserved.

ABN 56 623 302 296

← Back to Resources
ActivitiesSimulator ActivitiesIntermediate

Activity: Line Following

Coding Skills

BranchingIterationAlgorithm Design

Rover Concepts

Colour
Activity: Line Following

Program the Rover to follow a line. Use the colour sensors to detect where the line is and determine how the Rover should move and turn to stay on it.

Rover following a line on a marked track

Rover following a line on a marked track

Setup

When setting up, ensure the line to be followed has clear contrast from the surface it’s on and is thick enough for the colour sensors to detect. We recommend a thickness of 1–2 cm: anything less will be difficult for the Rovers. When designing a track, use rounded corners for turns; the sharper the turn, the harder it will be to stay on the line. You can also incorporate additional challenges, like having the Rover detect and go around objects on the track, or detecting different coloured lines that indicate speed changes or turning directions at intersections.

Our Approach

Stage 1: Loop with Branching

Add a While True loop with an IF/ELSE statement so you can continuously ask the Rover questions about its environment.

Stage 2: Pick a Brightness Threshold

Add the brightness value you’re comparing to (in this case, 210). To find the right value, open Sensor View in the Code Editor, press the ROVER button in the top bar. The colour sensor values appear in the top-right table.

Stage 3: Steer Based on the Sensor

Pick a brightness value between your line and the colour next to your line, e.g. if your sensor reads 130 for black and 230 for white, 180 is a good starting point. Then get the Rover to drive gradually left or right using the Set Motor Speeds block.

Tip: Test with different numbers! In our example, a speed difference of 8 for the motors worked well, but the right value for your Rover may vary. You could also experiment with RGB values to see if that gives a better result.

Example code, line-following with brightness threshold

Example code, line-following with brightness threshold

Once your Rover can follow a basic line, try adding intersections, tighter curves, or speed changes to push your algorithm further.

Continue Learning

Getting Started With Proportional ControlRelated resourceGetting Started With Proportional ControlAn introduction to proportional control, what control systems are, the key components, and how to apply proportional control on the Micromelon Rover.

Activity: Lane GuidanceRelated resourceActivity: Lane GuidanceLearn iteration, branching, algorithm design, maths, and how to use the motors, ultrasonic, and IR sensors.

← Return to Resources