PIPER MAKE

EDUCATOR GUIDES


YOU ARE HERE

Base expedition

Mission 9 of 13

Base expedition: Mission 9 of 14

Speak Like a Machine


Advanced

1 hour

Grades 3 - 8

MISSION OBJECTIVE

Learn to build buttons that will translate numbers to binary.

In this project, students will explore binary code, a foundational part of computing. Students will try to “speak” a few numbers in machine language, just as computers do.

View student interface at make.playpiper.com
MISSION CHARACTERS

Piperbot

Pip

Binator
MISSION MATERIALS

Computer with USB port and Chrome or Edge browser
Piper Make Base Station or Starter Kit

MISSION RESOURCES

Learning Goals

  1. Students will build two tactile buttons and use functions to convert from binary to decimal numbers.
  2. Students will understand what lists do in code and how they are used to store a collection of information in an organized way.
  3. Students will understand how binary has been used throughout the history of computing and why almost all computer systems are based on binary.
I WILL BE ABLE TO...
  • Build a two-button translator to convert binary to decimal!
  • Understand why almost all computer systems are based on binary

Learning Activities

ELA Extension: Robot Miscommunication Comic

  • Pair students up or allow them to work independently based on writing and drawing preferences. Students will write and illustrate a comic or short story that shows what happens when a robot follows commands too literally—leading to unexpected or hilarious results.
  • Begin by brainstorming a funny or chaotic scenario in which a robot misunderstands a command. Examples: “Piperbot was told to ‘go bananas’ and started launching fruit across the room.”
  • Have students develop their story using clear cause-and-effect structure:
    • Who gave the command?
    • What did the robot do (literally)?
    • What was the outcome?
  • Students will write and illustrate their story using dialogue bubbles, narration boxes, and sequencing words such as: first, then, next, finally.
  • Encourage them to highlight how miscommunication between humans and robots can lead to silly or surprising consequences. Stories may be one full comic strip, a three-panel cartoon, or a written narrative with spot illustrations.

Bonus vocabulary words to include: command, sequence, robot, input, output, literal

EXTENSION: Students write an alternate version of the story where the human gives a clearer command and the robot responds correctly. Have students present both versions side by side and reflect on how clarity changes outcomes.



ELD Extension: Command & Sequence Practice
  • Pair students so that each English Learner (EL) is working with a fluent or higher-level EL. Students will develop listening, speaking, and sequencing skills through guided physical movement and structured oral practice.
  • Begin by introducing simple command words with visuals and gestures: stand, sit, turn, stop, go, clap, spin, wave Practice each word using call-and-response and teacher modeling.
  • In pairs, students take turns playing the “programmer” and the “robot.” The programmer gives a sequence of 2–5 commands (e.g., “Clap twice, then turn left.”) The robot must follow the commands exactly—no improvising or guessing!
  • After each round, students switch roles and then retell what happened using sentence frames:
    • “My partner told me to __, then __.”
    • “The robot __ when I said __.”
  • Wrap up with a class reflection:
    • What made the instructions easy or confusing?
    • What happened when the robot didn’t follow the command exactly?
  • Use sentence frames to support oral responses:
    • “The robot __ when it heard __.”
    • “I gave the command __, and the robot __.”
    • “First we __. Then we __.”

Math Extension: Step-by-Step Algorithms
  • Pair students together or allow them to work independently based on task complexity and math readiness. Students will identify and write clear, step-by-step instructions (algorithms) to complete a simple task, exploring the role of order and logic in solving real-world problems.
  • Begin with a Step-by-Step Task. Choose a simple activity such as:
    • Making a peanut butter sandwich (or a paper version)
    • Walking to the pencil sharpener
    • Drawing a face or shape (e.g., triangle, square)
  • Students will write an algorithm using numbered steps. Example: “Step 1: Pick up the pencil. Step 2: Draw a circle.” Emphasize clarity, order, and logic—like giving instructions to a robot.
  • Students then test and debug by trading instructions with a partner who acts as the “robot.” The “robot” must follow the steps exactly—no guessing! If the task doesn’t work as expected, students revise their instructions to correct or clarify.
  • After testing, students reflect on the process using prompts such as:
    • “What did I need to fix in my algorithm?”
    • “How did the order of steps affect the outcome?”
    • “Where did my logic break down?”

EXTENSION CHALLENGE: Introduce if/then logic to handle conditional steps (e.g., “If the cap is on, then remove it”). Add loop or repeat commands for actions that occur more than once (e.g., “Repeat 3 times: draw a line.”)

Career Connections

Software Developer: Salary $127,260/yr
Electrical Engineer: Salary $127,260/yr
Data Scientist: Salary $103,500/yr
Construction Manager: Salary $101,480/yr

Hardware Diagram




Code Diagram




Tutorial Steps

Speak Like a Machine

Help Piperbot and Pip understand what Binator is saying! Maybe it's the code to get into that old safe that has the tools they need...

What was the name of that code, Piperbot? Binary code or something?
That's right! Binary code is a fundamental concept in computing.
We're going to start by building a simple keypad—one button for 1 and one for 0. Then we're going to write a function that decodes machine language (ahem, binary) and prints out values that are well, more human language (that's base 10).

Click NEXT.

Let's gather our things, we're going to need some wires and two buttons to start!
Click NEXT.

We've wired some buttons before! All we have to do is make sure when the button is pressed, there's a connection between POWER to GROUND, right?
Set up your buttons like you see here, and make sure you connect one side of each button to a ground pin on the Pico and the other side to the GPIO pin shown in the picture below:
Click NEXT.

You're right, we have done this before! In Reaction Game we built code that could detect when a button was pressed!
Ooh ooh this time, we want to interpret the two buttons as ones and zeros! If only we could write code that we could "call" to do that...
What is the name for a set of code that executes and returns a result?
Variable
Action
Logic Gate
Function

A function is a set of code that does something and returns a result. Sounds like what we want here!
Open the Functions menu and grab a to do something block. Drag the block out to the workspace. Change the name of your new function to "scan buttons".

Then, let's define a variable called number value. Click the Variables menu, then click the Create variable... button, and then enter "number value" as the name.
That's the variable we'll use to hold our number as we use the buttons to enter it!
When button 1 is pressed, we want to add a value to the number value variable. Our variable needs to start at zero, so grab the set number value block and add it to the to scan buttons function:
Click NEXT.

We are used to counting and working with decimal numbers. Decimal numbers use powers of 10:
Hmm, I'm used to counting and working with decimal numbers. Those are powers of 10. Let me pick a number... Maybe 192? How does that work in decimal?
192 is a little different for me! In binary, there are only TWO possible values for every digit -- a one or a zero.
And instead of powers of 10 for each place - binary uses powers of 2:
Hmm it sounds like we need to figure how many keypresses we want our keyboard to "listen" for! Let's do 8!
We can enter an 8 digit binary number. This means we need two blocks - a loop that keeps track of the count, and a list of the binary place values.

Let's add the loop first. Grab a for each item block from the Loops menu and add it to the to scan buttons block. Now we need the list. Grab a create list with block from the Lists menu and drag it into the input of the for each item block.

Now, click the blue gear icon on the create list with block. This will open a mini-workspace just for the create list with block. Add item blocks until you have a total of 8 inputs. Then click the blue gear icon again to close the mini-workspace:
Click NEXT.

Grab a 0 block from the Values menu and add it to the first input of the create list with block. Do this again 7 more times until all of the inputs are filled.
Since I count in powers of 2, let's change the first 0 block to 128. Then change the rest of the values to: 64, 32, 16, 8, 4, 2, and 1!
Psst, if you right-click the create list with block, you can choose inline inputs from the menu and that'll make the block take up a little less space!
Click NEXT.

Sweet, now that we have our loop, let's make our code wait until one of the buttons is pressed!
Grab a wait until block from the Chip block and place it inside of the for each item block. Next, grab an and block from the Logic menu and place it into the input of the wait until block.
It can be either button right? So let's change the AND to an OR!
Since our buttons are connected to GP11 and GP12 we need to wait until either one of them is pressed. Grab an is pin block from the Chip menu and place it into the first input of the or block. Change the pin number to 11. Grab another is pin block, drag it into the second input of the or block, and change its pin number to 12:
Click NEXT.

Now that we can detect when either button is pressed, how do we figure out which button is pressed?
Ooh right because if I hit the button for 1, then we have to add a value to the number value variable right?
Grab an if do else block from the Logic menu. Right-click the is pin 11 block and select Duplicate. Drag the new copy of the block into the input of the if do else block.

Grab a change by block Variables menu and place it in the do part of the if do else block. Set the variable to number value. Then, grab an i block from the Variables menu and it in the input where the 1 is in the change number value by block:
Hey Pip, why do I need that i block?
Each time the for each loop happens, the next value from the list block gets copied into the i variable!
Since the left-most digit of an 8 digit binary number has a place value of 128, it grabs that value first, and if we press the left button on our two-button keyboard, the program will add 128 to our number value variable. Each time the loop goes around, it grabs the next value in the list.

Click NEXT.

Pip, I keep forgetting which buttons I'm hitting! Isn't there anyway to see what we've typed so far?
Oh good point! Let's print out a 1 or a 0 when we press one of the keys!
A response like that is called "Feedback", and it's an important part of any device that gets input from a user!

Grab a print without new line from the Chip menu and place it below the change number value block. Type 1 into the "_" block. Then, right-click and Duplicate the print without new line block and place it into the else part of the if do else block. Type 0 into the "_" block:
Click NEXT.

Hmm, It feels like I'm clicking quickly but my Pico says it takes me 0.2 seconds, which is apparently really long for it!
Wow that seems speedy to me! But I guess we'll have to write some code to WAIT for you to release the button!
If our program doesn't wait for the button's release, it will loop around again and treat it like another button press.

Grab a wait until block from the Chip block and place it below the print "1" without new line block. Change the until to while. Right-click one of the is pin 11 blocks from earlier in the program and select Duplicate. Place the new block into the input of the wait while block. Duplicate the wait while block and place the new copy below the print "0" without new line block. Change the 11 to 12:
That's it for our scan buttons function. Now we need to use it! Click NEXT.

Hmm, I hit start but nothing is happening!
Silly Piperbot! We've just written a function, we haven't written the main code to call the function yet! Let's do that now!
Drag a start block from the Chip menu onto the workspace:
Grab a repeat forever block from the Functions menu and connect it below the start block. Then, grab a scan buttons block from the Functions menu and place it into the repeat forever block:
Click NEXT.

Ooh ooh can we get the number that our function calculates to display really big on our screen? Like we're shouting it?
Grab a shout block from the Chip menu and connect it below the scan buttons block in the repeat forever block.

Drag the "_" block out of the shout block and drag it to the trash can to delete it. Then, grab a number value block from the variables menu and place it into the shout block:
Click NEXT.

Moment of truth! Will we be able to figure out what Binator's code was?
Now it's time to run our code and test it yourself!

Click CONNECT. Select your Pico and then click START.

Click the Console tab at the bottom of the workspace to see what buttons you are pressing.

Press the buttons and see how the combinations of zeroes and ones form numbers.
What was that code Binator was saying again? The code is only one number long in decimal, but it seemed like binator said a lot of ones and zeroes....
0-0-0-0-0-0-1-1
What is the code to Binator's safe?
124
2
8
3

With all the zeroes at the beginning, all we have to do here is add together 21 + 20 = 2+1 = 3!

Once you're ready to quiz yourself, pick a number between 0 and 255. Using the buttons, try to find the correct combinations of ones and zeroes that make up the number you chose.

Once you've gotten a good feel for how binary works, let's try going from machine to human language by switching from binary to decimal! To do so, simply change the values in the create list with block - try 1000000, 1000000, 100000, 10000, 1000, 100, 10, and 1. You can also adjust the length of the input by changing how many values are in the create list with block.


Click EXIT to return to the menu and start your next coding challenge.

Blueprint

OPEN IN BLUEPRINT VIEWER  DOWNLOAD

Have an different version? Look for more information on the Support Page.

Troubleshooting Tips

  • Are you not receiving any inputs from the button presses?
    • Ensure that you’ve plugged the wires into the right GPIO. Look at the Digital View to see which pin you’re affecting.
  • What is binary?
    • Binary describes a numbering scheme with only two possible values for each digit – 0 or 1 –. It is the basis for all binary code used in computing systems

Our customer support specialists are on hand to ensure your implementation of Piper runs seamlessly.
View Support Docs or Contact Support
EXPANDED RESOURCES

Term Glossary


Circuit A conductive path for the flow of current or electricity.

Power The current or flow of electric charge and voltage.

Microcontroller An integrated circuit containing a microprocessor with memory and associated circuits.

Variables A value that can change depending on conditions or information passed to the program. A storage location with a symbolic name used to keep track of a value that can change while a program is running (similar concept to using X and Y in an algebraic equation). Variables are not only numbers; they can also hold text, including whole sentences (strings) or logical values (true or false).

Input Device A hardware device that sends data to a computer, allowing interaction and control.

Output Device A piece of hardware that converts information into a form humans can sense and understand.

View Full Glossary

Standards Alignment