Codey Rocky - Events E1: Making Sweet Music
In this lesson, students will use their Codey Rocky to make a play tune when they press A, B or C on Codey Rocky.

Lesson
Overview
Description
In this lesson, students will use their Codey Rocky to make a play tune when they press A, B or C on Codey Rocky.
Objectives
students will be able to describe what an event is
students will be able to program an event using Codey Rocky
Before the Lesson
Preparation
Review our introductory video to get accustomed to Codey Rocky's different features: https://www.youtube.com/watch?v=q7t-H7s7yYM&t=13s
Fully charge the tablets and robots.
Install mBlock 5 on a compatible Windows or Apple device: https://www.mblock.cc/en/download/
Review
Sequences
Review sequences with students. Remind them that a sequence is a list of steps Codey Rocky must take in order to finish a task. Discuss that we use sequences on a daily basis in order to do everything that we do ourselves.
Have students recall real-life sequences such as getting ready in the morning.
Direct Instruction
Connecting to mBlock 5
Introduction to mBlock 5
Project your computer screen and open the mBlock 5 program. Point out the icon and how it can be found in your specific system or device. Discuss the wireless dongle and how it is used to connect a specific Codey Rocky to a computer. The dongle is required for the Codey Rocky to be connected to the computer, so keeping that dongle safe and with the proper Codey Rocky is very important.
(Optional) Work with the class to label their dongle and device if they are not labelled already. These can be permanent device identifiers using a label maker (i.e Codey Rocky 1) or have the class temporarily name their Codey Rocky and label it with a sticky note or piece of paper and tape. (even if a device has a permanent label, it is always fun to allow students to name their devices)
Model connecting Codey Rocky to mBlock 5 by performing the following steps:
Turn on Codey Rocky
Open mBlock 5 if it is not open already
In the area where it says "Connect your Device" click the BLUE connect button.

Plug in the USB dongle.
Select the USB dongle from the drop down. It will be listed as "/dev/tty.wchusbserial14xx" with the last two number being different depending on the port the USB is plugged in to (ex. 1410, 1420)

You will know the device is connected when the window in mBlock 5 changes, indicating a proper connection and your ability to now upload code to Codey Rocky.

(Optional) Have students connect and disconnect their Codey Rocky from mBlock 5 a number of times to practice the process so they can do it independently going forward when instructed.
Guided Practice
Introduce Events
Say "Today we are going to learn about events. Events are an action that causes something to happen. Believe it or not, we've already been using events in our coding!"
Say "Events, just like sequences, happen in real life too. We react to certain things all the time."
Ask students questions: Are there any Event in daily life? And what happens due to the Event? Give students time to think and provide some hints in the process. To name a few, the alarm goes off (Event) so you get up (what happens next); press the switch (Event) and the television is turned on (what happens next).
Say "We are going to press the button on Codey Rocky - the event - in order to have Codey Rocky play some music that we will make ourselves!"
Demonstrate Making Sweet Music
Use the code below to demonstrate how Codey Rocky can use the blocks in the Speaker section to create a sequence of notes and put them together with the right timing to make a song:
Many students should recognize this as the beginning of the Super Mario Bros. title song.
Remind students that Codey Rocky only plays the song when the A button is pressed. Pressing the A is an event which causes the program to run.
Independent Practice
Making Sweet Music
Leave the code you used to demonstrate the event on screen.
Say "Now it is your turn to make music with Codey Rocky. Replicate the code on my screen, upload it to Codey Rocky to make your own song. Remember to create an event for the song to start playing, like we did with the A button!"
Encourage students to have fun and be creative. Have them try to replicate a song they know instead of just making up random notes. The more time you have to give them to complete this task, the better their song will be.
Move around the room observing and assisting as needed. In particular, students will likely need help with the timing of the notes, and the precise key the note should be in.
(Optional) Allow students to use YouTube to search up the song they would like to partially replicate and keep it open to play and pause as needed.
Wrap Up
Wrap Up
Say "We are going to kick this up a notch now! Lets combine what we have learned about making music with what we have learned about making loops, events, and sequences to have Codey Rocky sing and dance and make faces on the screen. Let's have a dance party!"
Educational Standards
ISTE
ISTE
4d: Exhibit a tolerance for ambiguity, perseverance, and the capacity to work with open-ended problems.
5a: Formulate problem definitions suited for technology-assisted methods such as data analysis, abstract models and algorithmic thinking in exploring and finding solutions.
6b: Create original works or responsibly repurpose or remix digital resources into new creations.
7c: Contribute constructively to project teams, assuming various roles and responsibilities to work effectively toward a common goal.
CSTA
CSTA
1B-AP-10: Create programs that include sequences, events, loops, and conditionals..
1B-AP-11: Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.
1A-AP-12: Develop plans that describe a program’s sequence of events, goals, and expected outcomes..
1B-AP-15: Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intended..
1A-AP-15: Using correct terminology, describe steps taken and choices made during the iterative process of program development.
Alberta - Grade 5 - CTF
Grade 5
CTF
Planning, creating, appraising and communicating in response to challenges.
Working independently and with others while exploring careers and technology
Ontario - Grade 5 - Mathematics
Grade 5
Mathematics
Algebra (Coding)
C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves conditional statements and other control structures.
Nova Scotia - Grade 5 - ICT
Grade 5
ICT
P2: Students will be expected to use digital tools to develop ideas and original works in innovative ways.
TOC1: Students will be expected to
safely use many forms of current technology for learning with growing competence
demonstrate conceptual understanding of how information and communication technology, digital tools, and authorized networks support their learning
use terminology related to information and communication technology
British Columbia - Grade 5 - ADST
Grade 5
ADST
• Make changes and test again, repeating until satisfied with the product
• Use materials, tools, and technologies in a safe manner, and with an awareness of the safety of others, in both physical and digital environments
• Identify the skills required for a task and develop those skills as needed
• Use familiar tools and technologies to extend their capabilities when completing a task
• Demonstrate a willingness to learn new technologies as needed
