--- 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. ### Here’s 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 don’t 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. ![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1622691722875-A8F2392YSG73XLX93G0W/conversationbot-answer.png) Example Code ### Related Posts Resources [ ![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1639455538805-9NI7CPKR7IYG6D4RBKAN/high+quality+sumo.png) ](/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) [ ![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1637464845856-BBPD7GTIIHHOSJCFORWF/the+ultrasonic+sensor.png) ](/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) [ ![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1625616494179-LZHZP5MUA0E0MQKEB7HC/cropped+image+4.png) ](/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)