top of page

Lesson 3.4

Loops & Events with Light & Sound
Established Goals

Build a simple timing game with a random button controller for a custom made game with 4 different colored LED lights and a buzzer.

 

Students complete the Frog Frenzy project, in the Games section.

 

Lesson Time: 45 to 60 min

Can be extended for additional 7 to 10 hours.


Seven Additional Projects (as time allows): Talley, Siren, Circuit Design, Debug, Randomizer, Beat the Buzzer, El Pangolin are 45 to 60 min for each project (Beat the Buzzer and El Pangolin may require an additional class session).

​

Assessment: Summative Assessment 3.4

Learning Objectives
Students Will:

1

Practice coding loops.

2

Review these key electronics understandings:

  • Binary state of a button as an input

  • Sounds as auditory outputs

3

Practice computational concepts of

  • loops: running the same sequence multiple times

  • events: while a pin’s condition is on or off, another action happens

4

Create programs that use variables to store and modify data.

5

Create programs that include events, loops, and conditionals.

6

Decompose problems into smaller, manageable tasks which may themselves be decomposed.

7

Create programs by incorporating smaller portions of existing programs, to develop something new or add more advanced features.

8

Test and debug a program or algorithm to ensure it accomplishes the intended task.

9

Perform different roles when collaborating with peers during the design, implementation, and review stages of program development.

Lesson Preparation
​
  • Complete the coding and electronic builds yourself.  See Piper Quick Guide: Frog Frenzy

  • Suggested student to kit ratio is 2:1 up to 3:1. Students are in the same teams as before, or make adjustments as necessary to facilitate good teamwork.

  • Make sure Piper kits are built, connected, functioning, and batteries are charged for the Raspberry Pi and the speaker.

  • Retrieve student team storage boxes with Piper build components.

  • Provide storage devices to teams to hold electronics - such as paper plate or paper cup or plastic box.

OpenGuide_Orange_1a.png
  • Prepare for lots of noise in the class with this one as students try out different sounds in the Play code.

  • Plan how much time is left for students to work on additional projects and still have time for completing Phase 4 and 5 lessons.

  • Stress the completion, based on your students knowledge and skills, of all quick guide lesson components  as they cover variables, loops, conditionals, and lists. There are seven additional projects: Talley, Siren, Circuit Design, Debug, Randomizer, Beat the Buzzer, Simon are 45 to 60 min for each project (Beat the Buzzer and Simon may require an additional class session).

Lorem ipsum Lorem ipsum Lorem ipsum 

Lesson Resources:
Assessment_80_1a.png
ChainReaction_80_1a.png
ChainReaction_80_1a.png
SlideDeck_80_1a.png
Vocabulary_80_1a.png
ENGAGE

Introduction (5-8 minutes):

  1. Teacher-led Discussion: Ask students how they think computer games are created.  Ask how does the computer know when the player has taken an action such as pushed a button or clicked something on the screen?

  2. Revisit the PiperCode Ideas Map.

    • Ask students to add discoveries from the prior project, and address misconceptions.  

    • Tease out the main concepts and design practices or ask students to explain more to the whole group if they are giving just fragments of answers.

  3. Engage with enthusiasm “Are you ready to create your own game and explore what it is like to be a game developer or an engineer? Let’s do that with our Pipers! We will start with a simple game first, and as we have time you can continue to create more complex games.”

  4. [Optional] Play the Frog Frenzy opening video in project panel (1 minute) on a projector for all to see. Discuss the actions that are being taken and how the game is played, won, or lost.

  5. Remind students of the rules around troubleshooting on their own or asking a partner, before asking for help from an adult (SAY: ask three before me!)

 

Main Activity (30-40 minutes):

EXPLORE
  1. Encourage students to go through Frog Frenzy                       project steps to build the input/outputs and write the code.

  2. During this time, roam around the room, asking the essential questions* of this lesson:

  • How is the code for Frog Frenzy different than the other projects?

  • How do you win or beat the game? How is this commanded by the steps laid out in the blocks?

  • How is the game play defined by the code and timing of the button?

  • What is the significance of the “while” part of the block?

  • What sequences do you see in this code? How do they command actions or what happens as a result of those sequences?

  • What if we moved the lights or button to other spots on the breadboard? What would you have to change in the code?

  • Have you tried the Electronics tab? Notice that when PiperCode is running each line you’ll also see the pins light up too!

 

* These checks for understanding help reinforce learning of computer science skills such as creating loops, but also incorporating smaller portions of existing programs, to develop something new or add more advanced features. (CA CS 3-5.AP.12 & 14).  You can also tie back to science concepts of sound, energy transfer, patterns for transferring information, and testing prototypes (NGSS (4-PS4-2 through 4)

OpenGuide_Orange_1a.png
EXPLAIN
  1. Review vocabulary words and definitions that were encountered during the lesson.

  2. Go around the room to each team and have students demonstrate their solution. Use the pictures in the Frog Frenzy                        Quick Guide’s breadboard and code solution to verify the project and provide feedback and praise to each student.

 

Closing Activity (10-15 minutes):

OpenGuide_Orange_1a.png
ELABORATE
  1. Students take a picture of their control panel, circuits, and code. After completing projects, students take apart any circuits on separate breadboards and return parts to their proper bag in the storage bin.

  2. Students put away kits to focus on discussion.

  3. Teacher led discussion: Slides - How do loops and events work?

    • Review major concepts and link to when they learned them while building PiperCode, such as:  How do Loops compare to Events? When would we use one or the other?

    • Remind students of alternative explanations.

    • Refer students to alternative explanations about how the events work. (Celebrate multiple ideas and solutions).

    • Ask students what new ideas should be added to PiperCode Ideas Map.

OpenSlides_Blue_1a.png
EVALUATE
  • Have students brainstorm ideas to remix either the code to have the game play differently or the narrative interface of a different story involving two different colored lights. These brainstorm ideas can also be written in their journals.

  • Have students document Frog Frenzy as a project in their Piper Journal - both the code and the circuit created.  Evaluate their Piper Journals and teamwork with a rubric (see sample Grading Rubric in Appendix).

  • [OPTIONAL]: Have students add more to the PiperCode Ideas Map.

  • [OPTIONAL]: Have students complete the Quick reflection.  

​

EXTENSION:

  • Provide samples of circuit diagram components and circuit diagrams, and have students create circuit diagrams of the projects built in this lesson in their Piper Journal.

bottom of page