Build Your Kit page and full Micromelon website

Complete website build including:
- Build Your Kit store page with cart system, sectioned layout
  (Hardware, Software, Attachments, Spare Parts), inline quote
  request form, and sticky sidebar summary
- 16+ pages: Education, Platform, Resources, News, About Us,
  Download, Contact, Rover, Code Editor, Robot Simulator, etc.
- 89+ MDX resource articles and 18 news posts
- Store product images scraped from micromelon.com.au
- Quote request API route with Airtable integration
- Dynamic back links and cover photos on resource pages
- Redesigned downloads page
- Fixed corrupted MDX code blocks
This commit is contained in:
Tim Hadwen
2026-02-28 19:00:42 +10:00
parent 5233233662
commit 707c49dd3f
320 changed files with 22333 additions and 107 deletions

View File

@@ -0,0 +1,125 @@
---
title: "Activity: Ping-Pong Shooter"
date: "2023-10-12"
categories: ["Activities", "All", "Simulator Activities"]
tags: ["Colour Sensors", "Branching", "Iteration", "Algorithm Design", "Advanced"]
excerpt: "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"
featuredImage: "/images/resources/activity-pingpong-attachment.jpg"
---
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.
### Heres Our Approach
**Constant - **A constant is a variable that never changes when the code is run. In python, we write this in all capitals with underscores between words.
#### 1) Setting the Constants:
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/daee31e5-931c-4d58-afed-f0d3bbbc89d7/constant.PNG)
Start by making the servo_out and servo_in constants. servo_out is how long the servo spins to shoot a ball. servo_in is how long the servo spins to retract the pusher.
The constants we have provided might need to be tweaked for your specific rover. This can be done through trial and error to find the best values for you.
#### **2) The Shoot Function:**
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/8e0a0183-8a12-4be4-b13f-651342216b57/shoot.PNG)
Continuous servos can spin without limit, similar to a motor. Setting the servo to 90 degrees spins it at top speed in one direction, and -90 degrees turns it the other way. Setting the servo to 0 degrees stops the servo.
Here, we set the servo to spin and delay for the constant servo_out. We stop the servo for half a second and then turn it in the other direction for the duration of servo_in.
#### **3) Ultrasonic Loop:**
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/8ba170c0-6993-43f3-a730-b5343cd01493/ultrasonic.PNG)
In the main code, the rover spins around until the ultrasonic detects an object within 50cm. Put a Turn Left movement block in a while loop that checks the ultrasonic distance. The slower the rover turns, the easier it will be to find the tower, so adjust the speed accordingly.
If the rover keeps spinning a bit after seeing the tower, put a Turn Right on the outside of the loop to correct it.
#### 4) Colour Sensor Loop:
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/0dddb415-2352-4b94-9821-dbeb23825e5e/colour.PNG)
In this stage, the rover moves forward while the brightness reading from the middle colour sensor is low. For our setup, the ground had a brightness of 100 and the white tape had a brightness of 180. According to these values, when the brightness passes halfway from black to white (140), the loop ends.
Make sure to enter your own values for this part.
####
5) Fire!:
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/55da7e22-8216-4231-a14b-e31dbf4c3f70/fire.PNG)
The rover will stop the motors and call the *shoot* function to hit the tower. This will pause the robot until the entire shoot sequence is complete.
#### Complete Code:
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/70bb1ea0-f585-4367-adfb-2251e6dd9f2f/code.PNG)
**Tip: **
Our code aims to get as close as possible to the line and fire. However, another technique is to find the perfect distance from the tower to shoot from and use the ultrasonic to stop the robot.
### Related Posts
Resources
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1639455538805-9NI7CPKR7IYG6D4RBKAN/high+quality+sumo.png)
](/resources/creating-a-sumo-unit)
[All](/resources?category=All)
[Creating A Sumo Unit For Your Digital Technologies Class](/resources/creating-a-sumo-unit)
[All](/resources?category=All)
How to run a sumo unit in your digital technologies classroom.
[Read More →](/resources/creating-a-sumo-unit)
[All](/resources?category=All)
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1637464845856-BBPD7GTIIHHOSJCFORWF/the+ultrasonic+sensor.png)
](/resources/ultrasonic-sensor)
[All](/resources?category=All), [Guides](/resources?category=Guides)
[The Ultrasonic Sensor](/resources/ultrasonic-sensor)
[All](/resources?category=All), [Guides](/resources?category=Guides)
Learn all about the ultrasonic sensor!
[Read More →](/resources/ultrasonic-sensor)
[All](/resources?category=All), [Guides](/resources?category=Guides)
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1625616494179-LZHZP5MUA0E0MQKEB7HC/cropped+image+4.png)
](/resources/year-7-digital-tech-at-st-peters)
[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)
[Case Study: Year 7 Digital Tech at St Peters Lutheran College](/resources/year-7-digital-tech-at-st-peters)
[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)
See how Meg Foley at St Peters conducted a challenge for their Year 7s using Micromelon.
[Read More →](/resources/year-7-digital-tech-at-st-peters)
[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)