# Discrete Guitar (Gr. 6-8)

## Using the sensors on the mBot to split continuous data, into discrete data, and playing music along the way.

Description

Turn your robot into an instrument!? Is that possible? Well just like frets on a guitar, which split up the strings into notes, we can do the same thing with the ultrasonic sensor on our robot. This is a useful skill that will bring your coding abilities to the next level.

The mBot has sensor data streaming into it, but sometimes it needs to be controlled, and categorized. This is one important reason students are introduced to the difference between discrete and continuous data. In this lesson, students turn their mBot into an instrument, breaking up the continous sensor data, into discrete notes using if statements and threshold values.

Overall Curriculum Learning Goals

• Discrete and Continuous Data (Lesson Focus)

Overall Coding Learning Goals

• Loops
• Nested If Statements
• Sensor Inputs
• Intro to Syntactical Programming

Educational Standards

Ontario
• Grade 8 Mathematics – Data Management and Probability
British Columbia
• Grade 6 Mathematics – Statistics and Probability
Alberta

• N/A

Lesson Procedure

• Class 1 - Intro to mBlock, If Statements, and the Ultrasonic Sensor (~30min)
• Class 2 - Nested If Statements and Making Music (~20min)
• Class 3 - Looking Inside the Code (Syntax) (~30min)

Robots and Accessories

• mBots

Supplies

• Laptops
• Makeblock Software
• Cardboard/Paper and Tape (optional for instrument customization)

## Find Out More

mBot

mbot is the best of both worlds, transitioning students from Scratch Blocks to Text Code