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: Maze II

Coding Skills

BranchingIterationAlgorithm Design

Rover Concepts

ColourUltrasonicIRMotors
Activity: Maze II

Take your maze solving to the next level. In this intermediate challenge you’ll use both IR sensors alongside the ultrasonic sensor to make smarter decisions at intersections and handle more complex maze layouts.

A more complex maze setup with T-intersections

A more complex maze setup with T-intersections

Setup

Construct mazes with narrower pathways than in Maze I. Aim for 5–10 cm clearance on each side of the Rover. Include T-intersections and dead ends to force the Rover to make more complex decisions.

Building On Maze I

In Maze I we used the ultrasonic sensor to check ahead and one IR sensor to decide which way to turn. This worked for simple mazes but falls apart when the maze has more complex intersections. Now we’ll use both IR sensors to check left and right before deciding where to turn.

Stage 1: Check All Directions

Create variables for the wall distance on each side. Read both the left and right IR sensors as well as the ultrasonic sensor at each step. This gives the Rover a complete picture of its surroundings.

WALL = 10  # cm, distance below this counts as a wall
 
while True:
    front = Ultrasonic.read()
    left = IR.readLeft()
    right = IR.readRight()

Stage 2: Smarter Turning

With data from all three distance sensors, the Rover can make better decisions at intersections. Instead of always preferring left or right, prioritise based on which direction has more open space. Use nested IF / ELSE IF / ELSE blocks to handle the different combinations.

    if front > WALL:
        # No wall ahead, keep moving forward
        Motors.write(20)
    else:
        Motors.write(0)
        if left > right:
            Motors.turnDegrees(-90)  # left has more space
        else:
            Motors.turnDegrees(90)   # right has more space

Stage 3: Add the Colour Sensor

Use the colour sensor to detect a coloured finish line at the end of the maze. When the Rover detects the finish colour, it should stop and celebrate with LEDs or a buzzer sound.

    # Stop on green finish line
    if Colour.readSensor(option=Colour.CS.HUE, sensor=1) > 80 and \
       Colour.readSensor(option=Colour.CS.HUE, sensor=1) < 160:
        Motors.write(0)
        LEDs.setAll(0, 255, 0)
        Sounds.play(Sounds.TUNES.UP)
        break

Continue Learning

Activity: Maze IIIRelated resourceActivity: Maze IIIMaster maze solving with precise gyroscope turns, wall-following algorithms, and functions to create an efficient maze navigator.

Creating A Maze Solving Unit For Your Digital Technologies ClassRelated resourceCreating A Maze Solving Unit For Your Digital Technologies ClassHow to design, run, and assess a maze-solving unit in your Digital Technologies classroom, from learning objectives through to assessment criteria.

← Return to Resources