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
Activities

Activity: Stop On Colour Change

Coding Skills

BranchingIteration

Rover Concepts

Colour
Activity: Stop On Colour Change

Program the Rover to keep moving forward until it detects a change of floor colour with the colour sensors. Once it detects the new colour, stop the Rover.

Activity Demonstration: Stop On Colour Change

Setup

For this exercise we recommend a strip of tape stuck to the floor that contrasts the floor colour. It doesn’t have to be tape, all that matters is that there’s a clear change in colour for the Rover to detect. A piece of coloured paper works just as well.

Your solution should work no matter how far from the tape the Rover starts. Test the same code from multiple starting positions.

Our Approach

Stage 1: Move Forward

Tell the Rover to drive forward with a Start Moving motor block.

Stage 2: Check the Colour Sensor

While the Rover drives forward, constantly check the colour sensor. Use a Repeat Until loop where the condition is set to detect the desired colour, our code is looking for the brightness of the white tape.

Stage 3: Stop

The Rover keeps checking the colour sensor in the loop until the condition is true. After the loop, stop all motors.

Note: If the simple colour sensor blocks aren’t working, you may need to use a different comparison block to check more detailed readings from the sensor. Use the Rover’s Sensor View to identify the one that works best for you.

Example code 1

Example code 1

Continue Learning

Activity: Line FollowingRelated resourceActivity: Line FollowingLearn the colour sensor and simple algorithm design while following a line.

Activity: Prison EscapeRelated resourceActivity: Prison EscapeLearn branching and iteration using the colour sensors and motors.

The Colour SensorRelated resourceThe Colour SensorLearn what the colour sensor is, how it works, and how to code it on the Micromelon Rover.

← Return to Resources