Files
micromelon-website/content/resources/conversation-bot.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.0 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: Conversation Bot"
date: "2021-06-03"
categories: ["Activities", "All"]
tags: ["Branching", "Iteration", "Buzzer", "LEDs", "Beginner"]
excerpt: "Learn iteration, branching, and how to use the buzzer and LEDs."
featuredImage: "/images/resources/conversation-bot.png"
---
Use the input block to create a conversation between you and your rover. Use variables to save information in the conversation or ask the robot to do different tasks.
####
Relevant Coding Skills
Branching
Iteration
Functions
Variables
-->
Algorithm Design
-->
Maths
####
Relevant Rover Concepts
Ultrasonic
-->
IR
-->
Colour
Gyroscope
Accelerometer
Motors
-->
LEDs
Buzzer
Activity Demonstration
### Setup
This exercise doesn't necessarily require a lot of space as you can choose whether the robot will move or not. There is no limit to how the conversation can work. Try and involve things like LEDs and Sounds from the rover. This often leads to needing to use variables, branching, loops, and functions.
### Heres Our Approach
This example code is not the only conversation that can be had with the rover. This just demonstrates how you can use the input block with variables and if statements. This can be easily extended with loops, motors, sensors, and functions.
#### Stage 1
Use the request input block to greet the user and then ask which colour they prefer. We can use a print block with string concatenation to say hello. Make sure to store the inputs in well-named variables to make your code easy to read.
#### **Stage 2**
Use an IF statement to check whether the response is something we understand and the ELSE branch to say when we dont understand. Use a set all LEDs block to set the colour of the LEDs when we get a response we understand
#### **Stage 3**
Add more responses to the IF statement as ELSE IF (ELIF) branches.
![](/images/content/42e7a7-conversationbot-answer.png)
Example Code