PROGRAMMING WITH LIGHTS AND SOUNDS

Lesson Time:
45 to 60 minutes

LESSON GOALS

 

Once students have learned about and practiced the basics, they are ready to code an interactive game. This lesson allows students to complete the Frog Frenzy project in the Games section to create a simple timing game with a button with 2 different colored LEDs. This project also encourages students to get creative with the physical design of their device.

LESSON RESOURCES

 

CAREER CONNECTIONS

 

Data Scientist

Graphic Designer

App Developer

Video Game Developer

LEARNING OBJECTIVES

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.


LEARNING OBJECTIVES

1.

Practice coding loops.

 

2.

Review these key electronics understandings: Binary state of a button as an input and sounds as auditory outputs

3.

Practice computational concepts of loops and events

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 (10 Minutes)

 
  • 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.

  • 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).

 

engage

Introduction (5 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. 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!)
  1.  
explore

PiperCode Project Frog Frenzy (30-40 Minutes)

  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)

EXPLAIN

Debrief Activity (15-20 Minutes)

  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.

ELABORATE

Introduce Loops and Events

  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.

EVALUATE

Teacher Led Discussion (5% of Class Time)

  • 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.