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
141 lines
4.0 KiB
Plaintext
141 lines
4.0 KiB
Plaintext
---
|
||
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.
|
||
|
||
### Here’s 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.
|
||
|
||

|
||
|
||
Example Code
|
||
|
||
### Related Posts
|
||
|
||
Resources
|
||
|
||
[
|
||
|
||

|
||
|
||
](/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)
|
||
|
||
[
|
||
|
||

|
||
|
||
](/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)
|
||
|
||
[
|
||
|
||

|
||
|
||
](/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)
|