Code Jumper Curriculum: Lessons, Lesson 6 Loops
American Printing House for the Blind
Code Jumper Curriculum: Lessons
Copyright © 2020 American Printing House for the Blind
All rights reserved. No part of this publication may be reproduced, stored in retrieval system, or transmitted in any form or by any means, except as expressly permitted under copyright law, without written permission of the publisher.
Published by American Printing House for the Blind
1839 Frankfort Avenue, Louisville, KY 40206
www.aph.org | [email protected]
OVERVIEW
Lesson Objectives
Students will:
- Understand that the loop command in computer programs is a repetition
- Learn how to create programs using the loop command
Expected Outcomes
Students will:
- All students: Explain what a loop command is and why we use it
- Most students: Recreate a programming sequence using a loop command
- Some students: Create an original sequence requiring a loop command
Lesson Plan Structure
- Unplugged Activity
- Guided Code Jumper Activity
- Exploration
- Standards and Check for Understanding
Key Vocabulary
Loop: A way to organize commands in a computer program so they repeat a sequence of instructions a required number of times. In the case of the Code Jumper Loop pod, the loop will continue to repeat the sequence a set number of times.
Repetition: Repeating a set of commands in a computer program using a loop.
Resources
- Code Jumper Tutorial Videos
- The Hub: https://www.youtube.com/watch?v=KGb51PW9zJQ&lis;=
- Play and Pause Pod: https://www.youtube.com/watch?v=446jCw8qcDI&t;=
- Loop Pod: https://www.youtube.com/watch?v=EFKbKLlD3HI
- Code Cards
Instruction for Set Up
- Sample program set up and run by the teacher: Counting to Three Looped
- Sound Set: Sample Sounds: Numbers in Thread 1
THREAD 1 Numbers
LOOP 4 times
PLAY One at 1 times speed
PLAY Two at 1 times speed
PLAY Three at 1 times speed
END LOOP
END THREAD
- Sound Set: Sample Sounds: Numbers in Thread 1
- Program to be run by the teacher:
- Sound Set: Sample Sounds: Percussion on Thread 2
THREAD 2 Percussion
LOOP 6 times
PLAY Snare-Drum for 1 times speed
PLAY Hi-Hat 2 for 1.5 times speed
END LOOP
END THREAD
- Sound Set: Sample Sounds: Percussion on Thread 2
Unplugged Activity: Identifying Repetition
Objective
Introduce the students to the concept of a loop and how it can be modified to repeat a series of steps a required number of times.
Vocabulary
Loop: A way to organize commands in a computer program so they repeat a sequence of instructions a required number of times. In the case of the Code Jumper Loop pod, the loop will continue to repeat the sequence a set number of times.
Repetition: Repeating a set of commands in a computer program using a loop.
Materials
- Computer Science Journals
- White boards (one per group) / White board markers (one per group)
- Computer
- Determine recording materials needed to fit the specific needs of the classroom
Instruction
- Divide students into groups of three to five depending on the size of the class.
- Have the students sit together in small groups around the white board, and choose one person in their group to write down their ideas in the following activity.
- Explain that each group will report their ideas to the class and the teacher will then record each group’s suggestions by either writing on a classroom whiteboard or projecting it on a screen.
- Ask each group to record on their white boards three ideas of things they have to do multiple times in a row. (Examples: Doing math problems, handing out papers, setting table places, jumping rope, running laps around the gym, shooting a basketball, practicing a piano piece.)
- Once each group has three ideas, bring the class back together and ask one person from each group to report their group’s ideas. Record the ideas on the classroom whiteboard or projector.
- Instruct students to write in their Computer Science Journals the list of ideas reported as a class to help them remember examples of repetitive tasks or loops.
- Explain to students that there are often tasks we are asked to complete a certain number of times or until the job is done. For example, if they were told to move boxes from one place to another, they wouldn’t take one box and then stop until they were told to move another box. Instead, they would move the boxes until there were not any more boxes left to move.
- Tell students that tasks they have to do over and over are called repetitive tasks, or loops, in computer programming.
- Explain that computers are very good at repetitive tasks because computers don’t get bored or tired, and they are very good at doing things exactly the same way every time they are told.
Closure
Tell students that in computer programming, repetitive tasks are called loops. When students use a loop command, the sequence will continue to repeat until it is told to stop, based on the number of times they have programmed it to run.
Guided Activity: Making a Computer Repeat Commands
Objective
Students will:
- Identify commands that repeat
- Be introduced to the loop command and how to put the commands that need to be repeated inside a loop
Vocabulary
Loop: A way to organize commands in a computer program so they repeat a sequence of instructions a required number of times. In the case of the Code Jumper Loop pod, the loop will continue to repeat the sequence a set number of times.
Repetition: Repeating a set of commands in a computer program using a loop.
Materials
- Computer Science Journal
- Loops Code Card: Counting to Three, Looped
Instructions
- Introduce to students the idea of playing the same thing more than one time. Explain that a loop allows a programmer to do the same action multiple times in a row.
- Ask students to think about and record in their Computer Science Journals how to get Code Jumper to play the sequence of numbers 1, 2, 3, 4 three times in a row.
- Divide students into groups of two to three. In their groups, ask students to pull out all of their Play pods and the Hub and try to create the program using only the Play pods.
- Regroup and discuss the students’ findings. Ask students: Did it work? Were you able to create the count up to 3, four times? If not, why not? What else did you need that you did not have?
- Introduce the Loop pod. Explain that a loop can be used to repeat a set of commands. This is known as repetition in programming.
- Instruct students to hold the Loop pod. Point out the Dial, the Cords, and the Ports. Explain that the shorter Cord is where the loop connects with the main program. The loop itself begins with the Command pod that’s connected to the Port on the lower-right side of the Loop pod, and the loop ends with the Command pod that’s connected to the Loop pod’s longer Cord. Explain that the main program resumes with the Command pod that’s connected to the Port on the upper-right side of the Loop pod. Explain that the Dial on the Loop pod allows you to choose how many times the loop will repeat.
- Ask students to create the Count Up to Four program using the Loop pod. Ask students to determine how many Play pods they will need when creating a program using a loop. Push the rest of the Play pods to the side.
- Determine the order that students will connect the Pods so everyone gets a turn. Point out that the loop runs clockwise, starting at the yellow Dial. The program goes out the port on the lower-right, through the Play pods, back to the Loop pod’s longer cord on the lower-left, and back to the Dial. It repeats this as many times as it is told by the Dial on the Loop pod. When it is all done with the loops, the program continues to play whatever comes after the port on the upper right.
- Once all the Pods are connected, run the program and debug, if necessary.
- Ask the students to read the code in the Code Jumper app or by pressing the Play and Stop buttons on the Hub. Ask the students: How do you know that the play commands are inside the loop? How does the code differ from when there are just Play pods attached? (Expected response: They come between the Loop and End Loop statements.)
- Students can now create a program with a loop on their own. Have students create a loop using any of the Sound Sets or record a local song or rhyme that has repetition.
- Ask the question, what is the greatest number of times we can have a loop play with the Loop pod? Let them know that other computer programs can repeat commands millions of times!
Closure
- Ask the students to explain what repetition is and to give an example of how they used it in this lesson.
- Ask the students what they think the advantage is of using a loop. (Expected response: You can make a program that uses fewer commands.)
Exploration
Objective
Students will create a program with eight Play pods, set the sounds on each Pod, and run and trace the program.
Vocabulary
Loop: A way to organize commands in a computer program so they repeat a sequence of instructions a required number of times. In the case of the Code Jumper Loop pod, the loop will continue to repeat the sequence a set number of times.
Repetition: Repeating a set of commands in a computer program using a loop.
Materials
Exploration Code Card: Percussion
Instructions
- Have the students listen to the sample program: Exploration Code Card: Percussion
- Ask the students the following questions. You may need to repeat the program after the questions are asked the first time.
- Does the program use a loop? (Yes)
- How many times do the notes repeat in the loop? (6 times)
- What is the order of the notes within the loop? (Snare Drum then Hi-Hat 2)
- Ask the students to write down or touch-type this program’s code in their Computer Science Journals.
- Ask the students to create a program according to the code they wrote down. Then, have them debug their programs, if necessary.
- Have the students do a second exercise using a more complicated sample.
- Alternative activity is to have students create their own program using any Sound Set, or create a custom Sound Set and create a program with a loop.
Closure
Have the students record their program in their Computer Science Journals and reflect on other situations where they could use loops.
Standards and Check for Understanding
CSTA K-12 Computer Science Standards*
- 1B-AP-08: Compare and refine multiple algorithms for the same task and determine which is the most appropriate.
- 1B-AP-10: Create programs that include sequences, events, loops, and conditionals.
National Curriculum of England*:
Key Stage 1:
- Understand what algorithms are; how they are implemented as programs on digital devices; and that programs execute by following precise and unambiguous instructions
- Create and debug simple programs
- Use logical reasoning to predict the behavior of simple programs
- Use technology purposefully to create, organize, store, manipulate and retrieve digital content
- Recognize common uses of information technology beyond school
- Use technology safely and respectfully, keeping personal information private; identify where to go for help and support when they have concerns about content or contact on the internet or other online technologies
Key Stage 2:
- Design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts
- Use sequence, selection, and repetition in programs; work with variables and various forms of input and output
- Use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs
- Use search technologies effectively, appreciate how results are selected and ranked, and be discerning in evaluating digital content
- Use technology safely, respectfully and responsibly; recognize acceptable/unacceptable behavior; identify a range of ways to report concerns about content and contact.
Closing Activities and Check for Understanding
- Ask the student to identify something they do that involves repetition (such as brushing their teeth or setting a table) and to write or touch-type an algorithm for it that incorporates loops.
- Ask students to think about repetitive tasks that may require multiple loops.
Check for understanding | Completed |
---|---|
Students can identify a task that involves repetition | Yes / No |
Students can identify and break down a loop into individual steps that need to be repeated. | Yes / No |
Code Cards
Loops Code Card: Counting to Three, Looped
Sample program set up and run by the teacher: Counting to Three Looped
- Sound Set: Sample Sounds: Numbers in Thread 1
THREAD 1 Numbers
LOOP 4 times
PLAY One at 1 times speed
PLAY Two at 1 times speed
PLAY Three at 1 times speed
END LOOP
END THREAD
Exploration Code Card: Percussion
Sound Set: Sample Sounds: Percussion at Thread 2
THREAD 2 Percussion
LOOP 6 times
PLAY Snare Drum for 1 times speed
PLAY Hi-Hat 2 for 1.5 times speed
END LOOP
Exploration Code Card: Piano
Sound Set: MIDI Instruments: Piano at Thread 3
THREAD 3 Piano
LOOP 3 times
PLAY C5 for 1/2 a beat
PLAY D5 for 1/2 a beat
PLAY E5 for 1/2 a beat
PLAY F5 for 1/2 a beat
END LOOP
END THREAD
For more resources, visit codejumper.com
Copyright © 2020
1839 Frankfort Avenue
Louisville, Kentucky 40206
502-895-2405 • 800-223-1839