- 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>
40 lines
1.6 KiB
Plaintext
40 lines
1.6 KiB
Plaintext
---
|
||
title: "Activity: Roaming Rover"
|
||
date: "2021-06-03"
|
||
categories: ["Activities"]
|
||
tags: ["Iteration", "Ultrasonic", "Motors", "Beginner"]
|
||
codingSkills: ["Iteration"]
|
||
roverConcepts: ["Ultrasonic", "Motors"]
|
||
excerpt: "Learn to avoid obstacles with the ultrasonic sensor."
|
||
featuredImage: "/images/resources/roaming-rover.png"
|
||
---
|
||
|
||
|
||
Program the rover to move around the room using the ultrasonic sensor to avoid running into obstacles. If the rover detects an object, turn away from the object and keep moving forward.
|
||
|
||
### Activity Demonstration
|
||
|
||
<iframe width="560" height="315" src="https://www.youtube.com/embed/aX4v0hLU4zc" title="Roaming Rover Activity Demonstration" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen></iframe>
|
||
|
||
### Setup
|
||
|
||
When running the exercise, it can often work well to have a small obstacle course setup with flat surfaces like boxes and books for the rover to detect. The ultrasonic sensor works best against flat hard surfaces as it is detecting reflected sound waves. Angled or soft surfaces are harder to detect.
|
||
|
||
### Here’s Our Approach
|
||
|
||
#### **Stage 1**
|
||
|
||
Use an IF statement block with a logic comparison block to check if the ultrasonic sensor detects an obstacle in front of the rover.
|
||
|
||
**Stage 2**
|
||
|
||
Use the IF ELSE block to turn when an obstacle is detected and drive forward when it is not detected using motor blocks.
|
||
|
||
#### **Stage 3**
|
||
|
||
Repeat this behaviour by wrapping everything in a while loop. While true will repeat forever.
|
||
|
||

|
||
|
||
Example Code
|