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
ActivitiesBeginner

Activity: Random Bug Bot

Coding Skills

IterationMaths

Rover Concepts

MotorsColour
Activity: Random Bug Bot

Program the Rover to act like a bug and move around randomly looking for food. Use the random-number math block to generate a speed for each motor, this creates a randomly moving bug Rover.

Activity Demonstration: Random Bug Bot

Setup

Random number generation will have the Rover move around unpredictably. Depending on the ranges students use, the random numbers may send the Rover a long way. Set the speeds and durations to suit the space you have, and keep an eye on the Rovers while they drive.

Our Approach

Stage 1: Random Motor Speeds

Start with an advanced motor block that sets different speeds for the left and right motors. Inside each slot, use the Random Integer block from the Math category. We use the range −15 to 15, negative values send the motor backwards. The block has a chance of setting either motor forward or backward.

Stage 2: Random Duration

Control how long the Rover runs at each speed using a Delay block. To keep things unpredictable, use another Random Integer block to set the delay to between 1 and 3 seconds.

Stage 3: Loop Forever

Wrap everything in a While True loop so the Rover picks new random speeds each cycle.

Example code, random-speed bug Rover

Example code, random-speed bug Rover

Continue Learning

Activity: Random Bug Bot 2Related resourceActivity: Random Bug Bot 2Program your Rover to move like a bug, with a hunger lifecycle that ends in death if it can’t find enough food.

Activity: Roaming RoverRelated resourceActivity: Roaming RoverLearn to avoid obstacles with the ultrasonic sensor.

Activity: Wind-up RoverRelated resourceActivity: Wind-up RoverLearn iteration, variables, maths, and how to use the Rover’s motors and accelerometer.

← Return to Resources