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
ActivitiesIntermediate

Activity: Prison Escape

Coding Skills

BranchingIteration

Rover Concepts

ColourMotors
Activity: Prison Escape

Use the colour sensors to find and drive through the gap in the box. Rovers start in the middle facing a random direction and must leave through the gap, they cannot drive over the lines.

Activity Demonstration: Prison Escape

Setup

Use tape on a table or floor (or a printed arena) to create an outline. It doesn’t matter what colour the tape or surface is, as long as they contrast clearly so the colour sensors can detect them. Make sure the gap you leave in the wall is large enough for the Rover to move through.

The same code should work no matter where the Rover is placed to start. Don’t hard-code distances in your solution.

Our Approach

There are multiple ways to solve this challenge. This starter approach simply moves the Rover forward until it detects the wall. If it detects the wall, it reverses and changes direction. This cycle repeats until the Rover finds the exit. You can add randomness to the turning or some other strategy to find the exit faster.

Stage 1: Detect the Wall

Use an IF statement with a condition that checks if the colour sensor sees the tape (brighter than the floor). If the Rover detects tape underneath, it knows it has hit a wall, use motor blocks to go backwards, then turn.

Stage 2: Move Forward Otherwise

When the Rover doesn’t see the tape, use a motor block in the ELSE branch to move forward slowly.

Stage 3: Loop Forever

Wrap the whole behaviour in a While True loop so the Rover keeps trying until it finds the exit.

Example code, colour-sensor-based prison escape

Example code, colour-sensor-based prison escape

Continue Learning

Activity: Maze IIRelated resourceActivity: Maze IIBuild on your maze-solving skills by using both IR sensors and the ultrasonic sensor together to handle more complex maze layouts.

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

Activity: Colourful SoundsRelated resourceActivity: Colourful SoundsLearn iteration and how to use the colour sensor, LEDs, and buzzer.

← Return to Resources