LOOPS AND SEQUENCE

Lesson Time:
45 to 60 minutes

LESSON GOALS

 

This lesson will build off of the prior lesson by challenging students to apply understanding of the basic coding concepts to simulate a common device, the stoplight. Students will extend their knowledge of sequences and add complexity to coding for LEDs.

LESSON RESOURCES

 

CAREER CONNECTIONS

 

Data Scientist

Graphic Designer

App Developer

Video Game Developer

ESTABLISHED GOALS

As the second dive into coding, this lesson challenges students to extend understanding to solve problems by coding behaviors in the language of PiperCode.

The Stoplight project controls 3 LEDs: Green, Yellow, Red and includes practice changing the sequence of the lights, based on pivoting essential questions about a real life situation, a local intersection stoplight.

 

 

LEARNING OBJECTIVES

1.

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

 

2.

Review and understand computational concepts loops (running the same sequence multiple times) and sequence (identifying a series of steps for a task)

3.

Demonstrate computational thinking core concepts, including: Algorithm Design and Simulation

4.

Create programs that include events, loops, and conditionals.

5.

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

 

6.

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

7.

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

 

LESSON PREPARATIOn (10 MINutes)

 
  • Complete the coding and electronic builds yourself. See Piper Quick Guide: Stoplight Project

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

 

engage

Introduction

  1. Teacher led discussion: Ask “What do you think is going to happen in the Stop Light project?”(helps with engaging student curiosity).

  2. Teacher led discussion: Start a PiperCode Concept map (or Mind Map) to capture student thinking, either on a white/chalk board, or a Poster board, or a shared document, or use a map software tool.

    • Add sections for students to document and share their ideas, key discoveries, activate prior knowledge from Blink, questions, hints, etc. with their classmates as you begin Stop Light.  

    • Suggestions for sections: Class Rules, Bugs, Hints, Electronics, Blocks, Blink, StopLight, (later add Light Show and Frog Frenzy). Seed each section with some reflections from the last session’s closing or your own notes, but be deliberate to use the language and terms of your local students.

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!) Write that under class rules in the PiperCode Ideas map.

  1.  
explore

Main Activity (20-30 Minutes)

See Stop Light Project Guide

  1. Encourage students to complete the Stoplight Project steps in their groups.  

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

  • How is the sequence more complicated in this project than Blink? (ans: turning more LEDs on and off, each with wait time, we are doing 3 instead of just one).

  • How is this simulating a real-life stoplight? (ans: start with green, go to yellow, rest on red and we changed the wait time between each).

  • How might we adjust the time a light stays on to make your stoplight safer for pedestrians or cyclists? (ans: increase wait time. Perhaps add a buzzer which beeps during the wait time for red?)

  • EXTENSION: How might we create a two-way stoplight? (ans: add a breadboard with more LEDs and run parallel block code sequences to turn on the pins at the same time - but vary which pins come on so one set has Green on when the other has RED.)

* These checks for understanding help reinforce learning of computer science skills such as creating programs that use include loops, sequences; decompose problems into smaller tasks; or incorporate smaller portions of existing programs, to develop something new or add more advanced features. (CA CS 3-5.AP.12 through 14)

EXPLAIN

Activity Debrief (20-30 Minutes)

  1. Review vocabulary words and definitions that were encountered during the lesson, including Pseudocode, sequence, program, event, algorithm. Have students use their own language to explain these concepts.

  2. Facilitate: Walk the room to each team and observe breadboards and code. Use the pictures in the Stoplight Project Breadboard and Code Solution for review. Quickly verify that the lights are blinking properly. Ask students to explain what their code is doing and how it relates to the circuit. Provide feedback and praise to each student. If one student in a team is not answering, encourage him/her to provide the answers.

ELABORATE

Discussion Questions (5-10 Minutes)

  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 kit away to avoid distractions during teacher or peer led discussion.

  3. Teacher led discussion:  3.2 SLIDES - Loops and Sequences

    • Review major concepts and link to when they learned them while building PiperCode, such as: How do Loops and Sequences build further on the foundations of computation?

    • Remind students of alternative explanations.

    • Refer students to alternative explanations about how the blinking was activated and sequenced. (Celebrate multiple ideas and solutions).

EVALUATE

Assessing Understanding

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

  • [OPTIONAL]: Have students use Google Draw or the whiteboard to write in Pseudocode the basic logic of the project’s codes.

  • [OPTIONAL]: Have students complete a Quick reflection

  • Have students document the Stoplight project as a project in their Piper Journal to include: Pseudocode, their block code, and a sketch of the circuit created. They should note any roadblocks and how they troubleshot solutions, or how they might build it differently the next iteration. Evaluate their Piper Journals and teamwork with a rubric (see sample Grading Rubric in Appendix)

EXTENSION:

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