← Back to Library
Lesson PlanFreeFR

(Francais) E5: Functions - Part 2

Level E, Lesson 5: Students will use functions and combine them with event handlers and loops. They will use Blockly preset programs and Challenge Cards to practice their new skills. Objectives Studen

(Francais) E5: Functions - Part 2

Educational Standards

CSTA

ISTE

NGSS

Common Core

Instruction

Introduction

  1. Say, "We have done a couple activities using functions. Now we are going to combine functions with some other familiar coding concepts like loops and event handlers."
  2. Review a real-life example where you could use all these concepts together:
    • When you go to the store, you use a loop to walk through the store: walk up an aisle, turn right/left and then repeat. Once you are in the aisle, you use an event handler. You keep walking until an event happens, such as seeing something that's on your shopping list. When the event happens, you call a "pick up" function: reach out your hand, pick up the object, pull your hand back, put the object in the cart.

Quick Check

  • Ask, "What is a loop?" (Sample response: "A loop is a piece of code that repeats.")
  • Ask, "How do you use event handlers?" (Sample response: "An event handler waits for an event to occur before running the program under it.")

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 wanted to add (another function) to the program because . . .," "We changed actions in the function blocks here to solve the challenge because . . .").
      • Share any obstacles and difficulties they overcame during the activity (e.g., "At first, we weren't sure about the best place to add a loop, but then we ran the program a few times with the loop in a variety of locations to find the best place to put it").
  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 (add another function)?"
    • "I like how you (added the loop)."
    • "What if you (changed the cues)?"

Follow-Up Questions/Discussion

  • Why are functions important? (Sample response: "Functions help repeat non-consecutive sequences of code.")
  • How was your program affected by loops? (Sample response: "Loops allowed me repeat bits of code over and over.")

Assessment

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

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!

Tickle Tackle Extension

  1. Have students use the Wonder Journal: Dot Planning or General Planning worksheet to design ways to add to or alter the Tickle Tackle preset program. They can:
    • Change the function or add more functions.
    • Change or add lights, movements, and sounds in each function.
      • Add a loop.
    • Change the cues.
  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:
    • E 3.4: Dog Trainer
    • E 3.5: Tricks Galore
    • E 3.6: Obstacle Course
  3. For each challenge, encourage students to:
    • Use the Wonder Journal: Dash Planning or General Planning worksheets 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 Dash while the code is running.
    • Update their Challenge Card Checklists.

Guided Practice

Activity: Tickle Tackle

  1. Project your tablet screen, open the Blockly app, and go to the menu at the top left of the screen.
  2. Go to the Create New Project menu and select the Tickle Tackle preset program. Then tap "create."Tickle Tackle
  3. Say, "Let's see how Blockly uses both functions and event handlers in the Tickle Tackle preset program."
    • Ask the students to look at the program and predict what they think will happen when it is run.
    • Run the program to see if the students' predictions were correct.
  4. Ask, "How many event handlers can you find in this program?"
  5. Have student volunteers describe what happens when the program starts
    • Possible response: "Dot says, 'How do you do?'"
  6. Ask, "How would you make this program work for Dash instead of Dot?"
    • Possible response: "Change each event handler to Dash events. Change sound and animation blocks to Dash's sounds and animations."
  7. Say, "Now I want the function to be called twice for one of the event handlers. What event handler should we change?" (Sample response: "Button 2.")
    • Have a student volunteer add another Call Function block under the selected event handler and then press play to see how the program changed.

Quick Check

  • How many functions can you add in one program? (Sample response: "You can add an unlimited number of functions.")
  • If you use more than one function, how does your program know which one to "call"? (Sample response: "You assign each function a different name so that when you call the function, the program knows which one you want.")

Review

Functions Review

Briefly review how students used functions during the previous lesson by asking:

  • "How are functions different from loops?" (Sample response: "Loops repeat bits of code consecutively, while functions repeat bits of code in many different places.")
  • "What is the purpose of functions?" (Sample response: "Functions help make programs more efficient by allowing us to repeat bits of code throughout the program.")

Code.Org Connections [Optional]

  1. Say, "As we level up our coding skills, we have to put everything we've learned together to complete challenges. You need to think about what needs to be accomplished step by step, and try to use a growth mindset. A growth mindset is when you think about your mistakes as ways to learn and grow. Mistakes in a growth mindset are thought to be positive learning experiences."
  2. Review Code.org's lesson focusing on functions and loops: https://studio.code.org/s/coursee-draft/stage/7/puzzle/1
  3. Point out how students needed to use both functions and loops to complete the lesson. Ask, "What was difficult about this task?"
    • Sample response: "It was difficult to follow the different parts of the code. I wasn't sure what would happen next."

Before the Lesson

Prior Experience

It is recommended that students complete:

  • Level A-D Lessons: All
  • Level E: Lesson 1-4
  • [Optional] Level A-D Challenge Cards: All
  • [Optional] Level E Challenge Cards: E 1.1-3.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.