Cover Page

Code Jumper Curriculum: Lessons, Lesson 13 Counters

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 be able to develop programs that use counters to increase or decrease values.

Expected Outcomes

Students will:

  • All students: Be able to explain how counters are used in programs
  • Most students: Be able to recreate programs that use counters using a model
  • Some students: Be able to create original programs that use counters to increase or decrease a value

Lesson Plan Structure

  • Unplugged Activity
  • Guided Code Jumper Activity
  • Exploration
  • Standards and Check for Understanding

Key Vocabulary

  • Counters: A parameter used in computer programming to increase or decrease the value of a variable.
  • Parameter: A value that is given to a command (Example: Which note to play).

Unplugged Activity:

Objective

After this lesson, students will be able to develop programs that use counters to increase or decrease values.

Overview

In this lesson, students will work in pairs to play a coin- or disc-flip game and tally the points in their Computer Science Journals.

Materials

  • Computer Science Journal
  • Coins or discs with two distinct sides (based on what will work for your students’ individual needs)

Instructions

  1. Explain to students that in programming we sometimes need to increase the value of a parameter by 1 each time a set of commands repeats (Example: Video games where the score continues to increase, like in Pong (http://arcade.gamesalad.com/g/123436).
  2. Have students brainstorm games they have played at school or at home where the score increases or decreases depending on the parameters (rules) of the game.
  3. Tell students that in the next activity they will play a game with a partner, using the concept of counters.
  4. Have students get into pairs with their Computer Science Journals.
  5. Tell students the goal for the game is to have the most points.
  6. Explain that to start the game, each pair of students will need to agree on the side of the coin or disc that is worth 1 point and which side will be worth 0 points.
  7. Explain to students that in pairs they will take turns flipping the coin or disc. When it is their turn, if the disc lands on the side worth 1 point, they will make a tally mark in their Computer Science Journal on the lesson page. If it lands on the side worth 0 points, they will not record a tally mark.
  8. Give students a set amount of time to play the game with their partners and record their tally marks in their Computer Science Journals.
  9. When time is up, have students share how many tally marks they won during the game.
  10. Explain that to increase or decrease a value in a computer program, they have to develop counters. Review with students that in this game, their counter was a tally mark for every point earned.

Guided Code Jumper Activity:

Objective

Students will be able to develop programs that use counters to increase or decrease values.

Materials

  • Counters Code Card 1: Numbers – Count Down With Loop
  • Counters Code Card 2: Musical Scale With Counters

Instructions

  1. Review what parameters are (Lesson 3). A parameter is a value that is given to a command. For example, Sound is a parameter, and under the Nature Sound Set, that parameter has eight values. Each value is a different Nature sound.
  2. Ask students to find the Counter plugs in the Code Jumper Kit. There are two: One with a plus sign and one with a minus sign. Discuss that we can increase or decrease the value of a parameter by 1 each time a set of commands repeats.

    Photo of a Plus counter plug

    Photo of a Minus counter plug

    [Figure Caption:] Photos of the tops of a Plus counter plug (left) and a Minus counter plug (right), with raised plus or minus sign
  3. Distribute the Counters Code Card 1: Numbers – Count Down With Loop. In their Computer Science Journals, have students predict what the program will do (Expected response: Count down from 6 to 1).
  4. Instruct students to create the program Count Down With Loop in the Code Jumper Kit and then run it to test their predictions. Ask students to record their findings in their Computer Science Journals.
  5. If students finish quickly, ask them to then create a counting-up program using the Counter plug with the plus sign.
  6. After everyone has finished creating the countdown program and recording their findings, ask students to take apart their pods and move them to the side for now.
  7. Recreate Counters Code Card 2: Musical Scale with Counters in Code Jumper for the class to listen to. Cover the pods with a cloth so all students are listening to the program but not looking at it. Play the program several times and ask students to record what they heard in their Computer Science Journals. It is not necessary to name the notes, but they should indicate how many notes are played and if they are getting higher or lower.
  8. After students have had the opportunity to listen to the program, ask them to think about how they would recreate the program. Ask them to write the code in their Computer Science Journals.
  9. Once students have written down the code, ask them to create the program in Code Jumper and then run the program, listening to see if the program is the same as the sample program.

Closure

  • In their Computer Science Journals, have students explain how they used the Counter plugs in their programs.
  • Ask students: How do you think Counter plugs would be useful in other Command pods, such as the Play pod?

Exploration:

Overview

Create a program that counts up or down.

Materials

  • Code Jumper Kit
  • Counters Code Card 3: Musical Scales with Variables and Counters
  • Counters Code Card 4: Explosion Countdown

Setup

  1. Ask students to analyze the sample program using Code Card 3: Musical Scale With Variables and Counters. Create the program and cover it with a cloth so students are listening to but not looking at the program. Ask students: How many loops are there? (Expected response: Two.)
  2. Have students recreate the program using only two Loop pods and three Play pods.
  3. Ask students to analyze the program and record their observations in their Computer Science Journals.
  4. Ask students to change the Sound Set to Explosion and create a program that counts from 5 down to 1. At the end of the program there should be an explosion, or a breaking glass sound. Ask Students: How can we play a different sound when the countdown reaches 1? (Expected response: You can use the Selection pod to set the value of x.)

Standards and Check for Understanding

CSTA K-12 Computer Science Standards*

  • 1B-AP-09: Create programs that use variables to store and modify data.

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 students to think of a time when a counter would be useful in everyday life. An example is the countdown for a rocket launch.
Check for Understanding Completed
Student can explain how using a loop and counters can create a program that can increase or decrease a value. Yes / No

Code Cards

Student Code Cards

Counters Code Card 1: Numbers – Count Down With Loop

THREAD 1 Numbers

LOOP 6 times

PLAY count down from Six for 1 times speed

END LOOP

END THREAD

A photo of a Code Jumper program in Port 1.

A photo of a Code Jumper program in Port 1.

[Figure Caption:] This photo displays a Code Jumper program in Port 1. The Loop pod is connected directly to the Hub and is comprised of one Play pod. with a Minus plug in its Sound dial.

Counters Code Card 4: Explosion Countdown

THREAD 1 Explosion

x = 5

PLAY x for 1 times speed

LOOP 4 times

x = x - 1

PLAY x for 1 times speed

END LOOP

IF x > 1

PLAY Oh no! for 1 times speed

ELSE

PLAY Explosion for 1 times speed

END IF

PLAY Oh no! for 1 times speed

END THREAD

A screenshot of a Code Jumper program in Thread 1.

Teacher Code Cards

Counters Code Card 2: Musical Scale With Counters

Thread 2 Piano

LOOP 7 times

PLAY Count up from C5 for ½ a beat

END LOOP

LOOP 8 times

PLAY Count down from C6 for ½ a beat

END LOOP

END THREAD

A screenshot of the Code Jumper app with a program in Thread 2.

A photo of a Code Jumper program containing two Loop pods, two Play pods, a Plus plug, and a Minus plug.

[Figure Caption:] At the top is a screenshot of the Code Jumper app with a program in Thread 2. Under THREAD 2 Piano, the commands read, LOOP 7 times, PLAY count up from C5 for 1/2 a beat, END LOOP, LOOP 8 times; PLAY count down from C6 for 1/2 a beat; END LOOP; the commands are followed by END THREAD. Below the screenshot is a photo of a Code Jumper program containing two Loop pods, two Play pods, a Plus plug, and a Minus plug. The first Loop pod is connected directly to the Hub at Port 1 and is comprised of a Play pod with a Plus plug in its Sound dial. The second Loop pod is connected to the upper-right port on the first Loop pod and is comprised of a Play pod with a Minus plug in its Sound dial.

Counters Code Card 3: Musical Scale With Variables and Counters

THREAD 1 Piano

x = 1

PLAY x for 1/2 a beat

LOOP 7 times

x = x + 1

PLAY x for 1/2 a beat

END LOOP

LOOP 7 times

x = x - 1

PLAY x for 1/2 a beat

END LOOP

A screenshot of a Code Jumper program in Thread 1.

Code Jumper

For more resources, visit codejumper.com

Copyright © 2020

American Printing House

1839 Frankfort Avenue

Louisville, Kentucky 40206

502-895-2405 • 800-223-1839

www.aph.org[email protected]