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 ActivitiesAdvanced

Activity: Ping-Pong Shooter

Coding Skills

BranchingIterationAlgorithm Design

Rover Concepts

Colour
Activity: Ping-Pong Shooter

Use the ping-pong shooter attachment to locate and topple towers from a distance. The ultrasonic sensor can be used to find the tower by searching in a radar motion. Once the tower is located, the distance can be used to move the rover close enough to topple the tower.

Setup

Start with a large empty space on the floor, and place a tower, approximately 20cm tall, with a light object like a Lego figurine on top. The tower should be made of lightweight material like paper or cardboard. The larger the tower, the easier it is for the shooter to hit, so choose a size from 10cm - 5cm wide. Outline a circle of tape on the ground around the tower. This is the shooting limit that the rover must not cross over. Again, the larger the ring, the harder it is to hit the target, so size accordingly.

First, the rover must be placed in a random location near the tower. Then, the robot should spin around and locate the tower. Finally, it must distance itself from the tower without crossing the line and hit the tower with a ping-pong ball.

Our Approach

Constant: a variable that never changes while the code is running. In Python, we write these in all capitals with underscores between words.

1Setting the Constants
  • Set the SERVO_OUT constant to 4 and the SERVO_IN constant to 3.
  • SERVO_OUT controls how long the servo spins to shoot a ball. SERVO_IN controls how long the servo spins to retract the pusher.
  • These values might need to be tweaked for your specific rover through trial and error.
2The Shoot Function
  • Create a shoot function that moves the left servo to -90 degrees, delays for SERVO_OUT seconds, stops the servo, waits 0.5 seconds, then spins the servo to 90 degrees for SERVO_IN seconds, and stops it again.
  • Continuous servos spin without limit, similar to a motor. Setting 90 or -90 degrees spins at top speed in each direction, and 0 degrees stops the servo.
3Ultrasonic Loop
  • In the main code, use a "repeat until" loop that checks if the ultrasonic distance is less than 50cm. Inside the loop, turn left at speed 7.
  • After the loop, turn right by 5 degrees to correct for overshoot.
  • The slower the rover turns, the easier it will be to find the tower, so adjust the speed accordingly.
4Colour Sensor Loop
  • Use a "repeat while" loop that moves forward at speed 5 while the brightness reading from the middle colour sensor is less than 140.
  • For our setup, the ground had a brightness of 100 and the white tape had a brightness of 180. The threshold of 140 is halfway between them.
  • Make sure to enter your own values for this part.
5Fire!
  • Stop the motors, then call the shoot function to hit the tower.
  • This will pause the robot until the entire shoot sequence is complete.

Tip: Our code aims to get as close to the line as possible and fire. Another technique is to find the perfect distance from the tower to shoot from and use the ultrasonic sensor to stop the Rover at exactly that distance.

Continue Learning

Activity: Claw AttachmentRelated resourceActivity: Claw AttachmentUse the claw attachment to grab the Meloncube and complete delivery tasks in a warehouse scenario, using the colour sensors to read delivery instructions.

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

Activity: Sumo IIIRelated resourceActivity: Sumo IIIMaster sumo with advanced strategies using the gyroscope for precise movement, the accelerometer for defensive tactics, and functions for clean code.

← Return to Resources