- 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>
35 lines
2.0 KiB
Plaintext
35 lines
2.0 KiB
Plaintext
---
|
||
title: "Activity: Spike Drop"
|
||
date: "2022-02-23"
|
||
categories: ["Simulator Activities"]
|
||
tags: ["Colour Sensors", "Branching", "Iteration", "Ultrasonic", "Robot Simulator", "Beginner"]
|
||
codingSkills: ["Branching", "Iteration"]
|
||
roverConcepts: ["Colour", "Ultrasonic"]
|
||
excerpt: "Simulator activity for learning ultrasonic, colour sensor and iteration."
|
||
featuredImage: "/images/resources/spike-drop.jpg"
|
||
---
|
||
|
||
Find a way to drive the simulator rover into the green parking lot. Use your colour or ultrasonic sensor to help you find the safe zone. Watch out though, go to far and you’ll fall and get spiked!
|
||
|
||

|
||
|
||
### Activity Demonstration
|
||
|
||
### Setup
|
||
|
||
This activity requires no physical setup, just make sure you connect the Code Editor to the Robot Simulator. If your unsure what the Robot Simulator is or need help setting it up, see our post [Getting Started With The Robot Simulator.](https://micromelon.com.au/resources/robot-simulator)
|
||
|
||
### Here’s Our Approach
|
||
|
||
#### Solution 1
|
||
|
||

|
||
|
||
The first solution involves using the ultrasonic sensor. We use a repeat while true block, but instead of leaving it on true we tell it to repeat while the ultrasonic sensor detects a number larger than 55. Once our rover detects the warning wall suspended above the spikes within 55cm it means we are directly in our safe zone and can stop moving.
|
||
|
||
#### **Solution 2**
|
||
|
||

|
||
|
||
The second solution is a bit more dynamic, uses the colour sensor and will work better if you move the rover and it needs to detect green multiple times within the one program. The benefit here is that the program won’t end on green, but it keeps making sure the colour is detected. We do this by using an IF/ELSE statement inside of a while true loop. We look for the colour green as before, but this time instead of ending the loop we just keep telling the motors to stop moving, and any other colour we will still keep the forwards movement.
|