Files
Tim Hadwen 1f8c46597b Site audit: fix broken images, add activity metadata, clean up content
- Remove broken image references from 25 MDX files (deleted spacer/content images)
- Add codingSkills and roverConcepts frontmatter to 24 activity pages
- Fix "Activity Demonstration" headings in 15 activity files (plain text -> h3)
- Remove unused "All" category from 89 MDX files
- Decode HTML entities (> <  ) in 9 content files
- Escape bare < > characters in MDX to fix build errors
- Standardize contact email to contact@micromelon.com.au
- Add missing description to rover-repair-request metadata
- Include previous session work: about-us updates, difficulty filtering,
  LearningPathway component, expanded schools list, new product/resource images

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 21:49:15 +10:00

40 lines
2.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Activity: Puppy Bot"
date: "2021-06-03"
categories: ["Activities"]
tags: ["Branching", "Iteration", "Functions", "Motors", "Ultrasonic", "Intermediate"]
codingSkills: ["Branching", "Iteration", "Functions"]
roverConcepts: ["Ultrasonic", "Motors"]
excerpt: "Branching and looping with the ultrasonic sensor."
featuredImage: "/images/resources/puppy-bot.png"
---
Program the rover to act like a puppy. When the rover detects an object within 50cm using the ultrasonic sensor have the rover charge forward. Once the rover gets within 20cm from the object it stops and waits for it to move. When the puppy bot cant see anything with the ultrasonic, slowly spin on the spot looking for something to follow.
### Activity Demonstration
<iframe width="560" height="315" src="https://www.youtube.com/embed/E4Bi3NhsmJI" title="Puppy Bot Activity Demonstration" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen></iframe>
### Setup
The distances used in the code can change depending on how much space you have. Just keep in mind the max range of the ultrasonic sensor is about 100cm. If the ultrasonic sensor cant detect anything it will return a reading of 255cm. The below solution can be extended to use functions in each branch to make the rover better at finding and following people.
### Heres Our Approach
#### **Stage 1**
Start with setting up our IF statement with 3 branches. Firstly if the rover detects something within 20cm with the Ultrasonic sensor, stop the rover. Then use an ELSE IF (ELIF) that checks if the rover detects something within 50cm. Lastly we have the ELSE branch for when the ultrasonic sensor doesnt detect anything close.
#### **Stage 2**
Place the appropriate motor blocks for the conditions. When the rover is stationary waiting for its owner to move, stop all motors. When the rover is starting to chase move forward at high speed. When it senses nothing from the ultrasonic just slowly turn on the spot searching.
#### **Stage 3**
We want to repeat this behaviour forever so place everything inside a repeat while true loop.
![](/images/content/813845-screenshot-2023-10-31-083156.png)
Example Code