← Back to Library
Lesson PlanFreeFR

(Francais) C4: Events - Event Handlers, Part 2

Description Level C, Lesson 4: Students will identify why we use event handlers and will use a variety of event handlers effectively. They will use Blockly preset programs and Challenge Cards to pract

(Francais) C4: Events - Event Handlers, Part 2

Before the Lesson

Prior Experience

It is recommended that students complete:

  • Level A-B Lessons: All
  • Level C: Lessons 1-3
  • [Optional] Level A-B Challenge Cards: All
  • [Optional] Level C Challenge Cards: C 1.1-2.3

You can purchase our Learn to Code Challenge Card sets and Curriculum Guide here: https://store.makewonder.com/#/education

Preparation

  • Fully charge the tablets and robots.
  • Install the Wonder Workshop Blockly app on each tablet.

Review

Events Review

Briefly review how students used events with Dash during the previous lesson by asking:

  • “What are events?” (Sample response: “An event is an action that causes something to happen. In a program, events are things the computer constantly looks for. ”)
  • “How did we use event handlers in the previous lesson?” (Sample response: “When we completed Loopy Shapes, we pressed Start to make Dash move one way and Button 1 to make Dash move a different way.”)
  • “How did you change the event handler?” (Sample response: “We tapped on the When Dash Button 1 block and chose another event.”)
  • “What is the purpose of event handlers?” (Sample response: “Event handlers help us control the exact moment something happens in our program.”)

Blockly In-App Puzzle [Optional]

  1. Have students complete the Police Officer Dash puzzle. You can find walkthroughs, solutions, and extensions for the puzzle.
  2. Have students update their Blockly Puzzle Checklists.
  3. Note: If previous puzzles are locked, show students how to quickly unlock them using this strategy: https://help.makewonder.com/customer/en/portal/articles/2318965-how-can-i-reset-challenges-unlock-free-play-or-unlock-wonder-cloud-?b_id=14312

Code.Org Connections [Optional]

  1. Review Code.org’s lesson focusing on events: https://studio.code.org/s/coursec-draft/stage/11/puzzle/1
  2. After completing the lesson, ask:
    • “How were events used in this game?” (Sample response: “Events were used to control the bird.”)
    • “How could you change the buttons and the events they control?” (Sample response: ”Instead of using When Click, you could make a new event handler called When Spacebar Is Pressed.”)

Instruction

Introduction

  1. Say, “Event handlers allow the code to listen or wait for multiple events while the program is running. The code under each event handler only runs when that event occurs. Today, we are going to use more than one event handler in our program.”
  2. Hold up Dot and ask, “What are the different event handlers that we could use for Dot?”
    • Sample response: “You can use When Dot Shake!”

Quick Check

  • When are events used?
  • What types of blocks can be placed under a When block? (Sample response: “You can place repeat, sound, and animation blocks under the When block. You can place a lot of other blocks there too!”)

Guided Practice

Activity: Old McDonald

  1. In the Blockly app, go to the menu at the top left of the screen.
  2. Go to the Create New Project menu and select the Old McDonald preset program. Then tap “create.”Old McDonald
  3. Ask students to look at the program and predict what they think will happen when it is run.
    • Run the program. Have student volunteers press Dot’s buttons, clap, or shake Dot to see if their predictions were correct.
  4. Ask, “How do you think we could change the event handlers?”
    • Select student volunteers to change the events in the different When blocks and run the program after each change so students can see the difference.
    • Encourage students to also try changing the sound blocks so that Dot makes different animal sounds.

Quick Check

  • Why do we use events? (Sample response: “Events allow us to control what happens as our program is running.”)
  • What are the different kinds of event handlers that can be used with Dot? (Sample response: “You can use a When Dot Top Button block.”)

Independent Practice

Instructions

Have students work on the following activities in small groups (ideally 2-3 students per robot).

Encourage students to share tablet and robot time. Have them establish and rotate through roles such as:

  • Lead Programmer: Holds the tablet and manipulates the code.
  • Robot Wrangler: Retrieves and resets the robot after every program attempt.
  • Documentarian: Records group results, thoughts, and progress. Illustrates group designs and ideas.

When students work together while coding, they're able to help each other identify mistakes and develop creative solutions!

Old McDonald Extension

  1. Have students use the Wonder Journal: Dot Planning and/or General Planning worksheet to design ways to add to or alter the Old McDonald preset program. They can:
    • Add another event handler.
    • Add/change the sound blocks.
    • Add lights or animations.
  2. After they finish revising the program, have students:
    • Complete a Wonder Journal: Reflection worksheet.
    • Take a screenshot of their Blockly code.
    • Take a video of Dot while the code is running.

Challenge Cards

  1. You can purchase our Learn to Code Challenge Card sets and Curriculum Guide here: https://logicsacademy.com/store/
  2. Have students complete the following Challenge Cards:
    • C 2.4: Sleepy Time
    • C 2.5: Wake Up
    • C 2.6: Lights Out!
  3. For each challenge, encourage students to:
    • Use the Wonder Journal: Dot Planning and/or General Planning worksheet to discuss how they can complete the challenge.
    • Review the Troubleshooting and Problem Solving & Debugging worksheet if they run into any problems with their code.
  4. After they finish each challenge, have students:
    • Complete a Wonder Journal: Reflection worksheet.
    • Take a screenshot of their Blockly code.
    • Take a video of Dot while the code is running.
    • Update their Challenge Card Checklists.

Educational Standards

CSTA

ISTE

NGSS

Common Core

Wrap Up

Student Presentations

  1. Have student groups take turns sharing one of their programs with the class. Encourage them to:
    • Explain their design thinking (e.g., "We added more event handlers because we wanted to include more animal sounds for Dot").
    • Share any obstacles and difficulties they overcame during the activity (e.g., "We weren’t sure how to change the event handlers, but then we tapped the When blocks and saw the other events we could use").
  2. Encourage students to ask each other how they accomplished different objectives and give each other feedback on their programs. Possible questions/feedback includes:
    • “How did you (change the event handler)?”
    • “I like how you (made Dot’s animal sounds more complicated by adding lights and animations.”)

Follow-Up Questions/Discussion

  • How could using event handlers make Dot’s animal sounds more interesting? (Sample response: “I could add more animal sounds by adding more event handlers.”)
  • What other blocks could you add to make Dot’s animal sounds more exciting? (Sample response: “Animation, light, or sound blocks.”)
  • How would the program be different if you didn’t use event handlers? (Sample response: “The program would run in a specific order. By using event handlers, we can control the sequence of the animal sounds.”)

Assessment

  • Use our Evaluation Rubric to review students' work and presentations.
  • [Optional] Share your students' work with the world using @logicsacademy and #dashanddot!