Files
micromelon-website/content/resources/turn-over-rover.mdx
Tim Hadwen ae3ae18585 Major site overhaul: resources hub, content migration, new blog posts, forms
- Redesign /resources as sectioned hub with category pages
- Migrate 645 Squarespace CDN images to local /images/content/
- Create 9 new news/blog posts with event photos
- Fix blog post slugs (rename gibberish filenames)
- Rename Design Blog to Design Blogs across site
- Remove education page, replace with Platform in nav
- Redesign rover repair request form with dynamic rover entries
- Add school search combobox to contact, store, and repair forms
- Extract shared KNOWN_SCHOOLS data
- Make /rover-expansion-3d-printing dynamically pull from MDX
- Add related resources sections to product pages
- Fix homepage broken /quote links to /store
- Store page: sample kit cards, inline quote builder, mailing list opt-in
2026-03-01 17:14:05 +10:00

82 lines
2.1 KiB
Plaintext
Raw 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: Turn Over Rover"
date: "2021-06-03"
categories: ["Activities", "All"]
tags: ["Branching", "Iteration", "Accelerometer", "LEDs", "Beginner"]
excerpt: "Learn branching, iteration, and how to use the accelerometer and LEDs."
featuredImage: "/images/resources/turn-over-rover.png"
---
Program the rover to detect if it is upside down or not. When the rover is the right way up set it's LEDs to green. When the rover is upside down set the LEDs to red. The rover should change the LEDs as soon as it detects a change in orientation, you should not need to press the play button to trigger a change in colour.
####
Relevant Coding Skills
Branching
Iteration
Functions
Variables
-->
Algorithm Design
-->
Maths
####
Relevant Rover Concepts
Ultrasonic
-->
IR
-->
Colour
Gyroscope
Accelerometer
Motors
-->
LEDs
Buzzer
-->
Activity Demonstration
### Setup
All you need is a flat, uniform surface to drive on. Different surfaces have different friction properties. This means the tracks will slip differently dependent on where the rover is driving. Some movement blocks such as turn by degrees are calibrated for an average friction. When driving on other surfaces you may need to turn more or less to get the desired angle.
### Heres Our Approach
#### **Stage 1**
Start with an IF Statement. Make the condition our sensor block that checks if the robot is the right way up.
#### **Stage 2**
If our condition is true (the robot is the right way up) we want to use a Set All LEDs block and make all the LEDs green. If our condition is not true (the robot is upside down), use the ELSE part of the IF statement to set all our LEDs to red.
#### **Stage 3**
If we run our code with just an IF statement it will check our sensor once and end the program. We want our robot to constantly check if it is upside down or not and change the LEDs accordingly so we put our entire IF statement in a repeat while true loop.
![](/images/content/900dde-turnoverrover-answer.png)
Example Code