Programming Things That Sense and Move

Program a small computer board so it reacts to the real world. You will find the computers hidden inside everyday machines, make lights blink, play sounds and drive motors, and read buttons and sensors that measure light, temperature, sound and movement. Then you will write control programs that keep checking and decide with if-then-else, and you will plan, build and test your own smart device, such as a night light, a step counter or an automatic gate, until it works in the place where it is really used.

Grade 5Lesson 8 of 10 in Computing and Coding for Ages 7 to 11 Course

What you will learn

  1. Find the small computers hidden inside everyday machines, and explain how every one of them takes in input, processes it and gives out output.
    • Spot the computers hidden in machines
      Learn what physical computing and microcontrollers are, and find the computers that control machines all around you.
    • Follow input, process and output in a system
      Split a device into its inputs, processing and outputs, and explain how its parts and the people who use it work together.
  2. Write programs that switch outputs on and off, change them over time and combine them, so your device can signal and move.
    • Light up LEDs and displays
      Switch lights on and off, make them blink with pauses, and show pictures, numbers and words on a display.
    • Make sounds and tunes
      Play tones and short tunes, choose sounds that send a clear message, and control when a sound starts and stops.
    • Make things move with motors
      Program motors to start, stop, change direction and change speed, and use a servo to turn something to an exact position.
  3. Use buttons, switches and sensors as inputs, find out what numbers your sensors give, and keep readings and counts in variables.
    • Use buttons and switches as inputs
      Make a device react to presses, choose between an event block and a check inside a loop, and turn everyday objects into touch inputs.
    • Measure the world with sensors
      Choose the right sensor for a job, explore the numbers it gives in different situations, and pick sensible threshold values from real readings.
    • Keep readings and counts in variables
      Use variables to count events, remember readings, make a device adjustable and log data over time.
  4. Use loops, pauses and if-then-else with real readings so your device keeps checking the world and reacts in the right way.
    • Keep checking with loops and timing
      Set things up once at the start, then use forever and repeat loops with pauses so the device keeps reading inputs and updating outputs.
    • Choose actions with if, then and else
      Turn sensor readings into decisions with comparisons and thresholds, and make sure the device does the right thing in both cases.
    • Handle several conditions and ranges
      Use else-if chains, "and" and "or" so a device can tell apart more than two situations, and test every branch.
  5. Plan a smart device for a real need, connect and program it safely, then test it where it will be used and improve it until it works.
    • Plan a device for a real problem
      Describe the problem and the people it is for, write criteria you can check, choose inputs and outputs, and plan the algorithm before you code.
    • Connect, download and run on the real device
      Connect parts to the right pins, follow safety rules, and send your program from the editor to the board.
    • Test in the real world and fix faults
      Plan and record tests, find whether a fault is in the hardware or the program, fix one thing at a time, and judge the finished device against its criteria.

Physical Computing study guide

5 chapters

1

Discover computers that sense and control things

A computer can work inside a door, a washing machine, or a toy. You will follow how its parts work together and what its program controls. You will also sort the information going in, the actions coming out, and the choices people make about the device.

1.1 Find the computer inside a machine

A washing machine can follow a program without a keyboard. Its computer is hidden inside the machine. You can program a small board to control things too.

A program reaches the real world

Physical computing means programming a device that senses and acts. It might notice movement, light an LED, or turn a wheel. An embedded computer is built into a larger machine. Traffic lights, microwave ovens, and robot vacuums have embedded computers.

A microcontroller is a tiny computer on one chip. It stores a program and runs its instructions. A microcontroller board holds that chip and places to connect parts. Classroom boards often have buttons, lights, and sensors already attached. A micro:bit is one example.

Two kinds of parts work together
KindWhat it meansExamples
HardwarePhysical parts you can touchBoard, wires, button, motor
SoftwareInstructions the computer runsA program that opens a gate

Changing software can change what the same hardware does. One board might blink a heart today and count shakes tomorrow. The board still needs the right connected parts. Instructions to move a gate cannot move it without a motor.

Follow an automatic door

Imagine walking toward a store's automatic door.

  1. A sensor notices that someone is near.
  2. The computer follows its program and chooses to open.
  3. A motor slides the door open.
  4. When nobody is near, the program waits, then closes it.

The sensor does not slide the door itself. Each part has its own job. A person chose the rules and wrote the program. The computer follows those instructions, including any mistakes in them.

When a machine acts like a robot

A robot can sense, decide, and act by following a program. A car that detects a wall and steers away does this. A toy car driven only by your remote follows your choices. Its movement alone does not show that it senses its surroundings.

Look for the job a machine does, not a screen. A washing machine's hidden computer still runs instructions, even when its only display is a few lights.

Key Takeaways

  • An embedded computer controls a larger machine.
  • A microcontroller board runs a stored program.
  • Hardware and software work together.
  • A robot uses a program to sense, decide, and act.

1.2 Trace information through a device

A device works because its parts share a job. You can follow the information through it in three stages: input, process, output.

What goes in, what happens, what comes out

An input gives the computer information. A button press or a light reading can be an input. An input device collects that information.

Processing happens when the computer follows the program. It might compare a reading with a number and choose an action. An output is the action it controls, such as a beep. A speaker, display, or motor is an output device.

Part of a night lightJob
Light sensorInput: measure the brightness
Computer running a programProcess: check whether the reading is below 40
LEDsOutput: shine when the answer is yes

For a reading of 12, the check is true. The program switches the LEDs on. For a reading of 95, the check is false. The program switches them off. The reading supplies information; the program gives that information a meaning.

Remember information

Storage lets the computer keep its program and values. A step counter keeps a count between movements. Without remembering the earlier count, it could not add the next step to it.

Some memory holds values only while a program runs. A board can also keep its downloaded program for the next start. Saving a program and keeping a running count are different jobs for storage.

People stay involved

At a crosswalk, your button press is an input. The program waits and changes signals in order. The signal lights and beeps are outputs. People also choose timings, write the program, and turn systems on or off. A useful device gives people clear controls, such as a stop button.

A part's role depends on what it does in that system. Light leaves an LED as output. That light can reach a sensor as input to another system.

Follow information, not power

A battery supplies power; it does not measure the world. Wires connect parts and carry power or signals. In a wired button, the button collects the input. Its wire carries that signal to the board. Ask, "Which part tells the computer something?" to find the input device.

Key Takeaways

  • Input gives information; processing follows the program; output acts.
  • Storage keeps programs and values.
  • People choose rules, settings, and controls.
  • A wire can carry a signal from an input device.
  • The same light can be output from an LED and input to a sensor.
2

Control lights, sounds and motors

Lights, sounds, and movement let a board send messages into the world. You will build patterns with pauses and choose an output that fits the job. Following each instruction in order will help you predict when a light changes, a sound ends, or a model stops moving.

2.1 Build a light pattern you can see

A light can show a message without making a sound. Your program controls when it shines and how long the message stays visible.

Show a picture or a number

An LED, or light-emitting diode, is a small light. Some boards have a grid of LEDs as a display. The micro:bit has 25 LEDs arranged in five rows of five. The display can show icons, numbers, or scrolling words.

A shown heart stays until another instruction changes or clears it. Turning an LED on does not make it turn off later. Put an off instruction in the program when you want darkness.

Give your eyes time

A computer can change a light too quickly to see clearly. A pause makes the program wait. Many pause blocks use milliseconds, written ms. There are 1,000 ms in one second. A pause of 500 ms lasts half a second.

Build a blink in this order:

  1. Turn the LED on.
  2. Pause for 500 ms.
  3. Turn the LED off.
  4. Pause for 500 ms.

The first pause holds the light on. The second holds it off. Put all four blocks inside a loop to keep blinking. If you only pause after turning it off, the on part may be too short to notice.

Make a model traffic light

Use separate green, yellow, and red LEDs. Start with all three off. Repeat these steps:

  • Green on; pause 5,000 ms; green off.
  • Yellow on; pause 2,000 ms; yellow off.
  • Red on; pause 5,000 ms; red off.

One cycle takes 12 seconds: five, then two, then five. Switching off each light keeps the next stage clear. A pattern placed only in "on start" runs once. Put it in "forever" when it must keep cycling.

Choose colors

Some colored LEDs mix red, green, and blue light. Red and green at full brightness make yellow. All three at full brightness make white. A plain single-color LED cannot change its color just because you choose a new color block. Choose an output that can show the message you need.

Key Takeaways

  • Pause after both the on and off steps to make a clear blink.
  • 1,000 ms is one second.
  • A display keeps its picture until an instruction changes it.
  • Use a loop for a repeating light pattern.

2.2 Give a sound the right message

A beep can confirm a button press. A tune can celebrate a win. A speaker or buzzer turns your program's sound instructions into an output.

Change pitch and length

Pitch is how high or low a sound seems. You choose a tone's frequency in hertz, written Hz. A higher frequency produces a higher-pitched tone. Middle C is about 262 Hz. The A above it is 440 Hz.

Duration means how long a sound lasts. A program can set duration in beats or milliseconds. A tune is a sequence of notes, with a pitch and duration for each. A higher pitch does not mean a longer note. Change the duration to change its length.

Program a doorbell

Put these instructions in "on button A pressed":

  1. Play 523 Hz for one beat.
  2. Play 392 Hz for one beat.

The first sound is higher. The second is lower, giving a "ding-dong" pattern. Each press plays the sequence once. Some boards have a speaker built in. Others use a connected speaker or buzzer.

Choose when the next block runs
Sound blockWhat the next block does
Play until doneWaits for the sound to finish
Play in backgroundStarts while the sound can still be playing

Suppose a two-second sound comes before "show star". With "play until done", the star appears after the sound. With "play in background", the star can appear during it. Read the block's name when matching a light to a sound.

Keep signals useful

Use a short, soft sound for "OK". Use a repeating warning only while the warning is needed. A sound in an unconditional forever loop starts again every round. Give the alarm a condition or a control that silences it.

Start with low volume and short sounds when you test. Nearby classmates need to hear their own work too.

Key Takeaways

  • Frequency changes pitch; duration changes length.
  • A tune plays notes in a chosen order.
  • A waiting sound block delays the next instruction.
  • A warning sound needs a clear way to stop.

2.3 Choose movement and a stopping point

A wheel needs to keep spinning. A model gate needs to move to a chosen position. These jobs need different kinds of motor control.

Spin or turn to a position

A motor makes movement. An output that moves something is an actuator. With a spinning motor, you can choose direction and speed. Many kits use a percentage for speed: 100% is full speed, 50% is about half speed, and 0% is stopped.

A servo turns to a position and holds it. Many classroom servos accept angles from 0 to 180 degrees. The angle tells the servo where to point, not how long to spin.

JobUseful motor
Turn a fan or a wheelSpinning motor
Raise a flag to a chosen angleServo
Move a model gate between two positionsServo
Open and close a model gate

Suppose the gate is closed at 0 degrees and open at 90 degrees. Set it to 0 in "on start". In "on button A pressed", place:

  1. Set servo to 90 degrees.
  2. Pause for 5,000 ms.
  3. Set servo to 0 degrees.

The gate stays open for five seconds, then closes. Removing the last instruction leaves the servo holding the open position. A pause by itself does not close the gate.

Steer a buggy

A buggy can have one motor on each side. Both sides forward at matching speeds drive it straight. Both backward make it reverse. If the right wheel stops while the left moves forward, it turns right. It turns toward the slower side.

Test which direction moves your model forward. A motor's mounting can change the result. If it turns the wrong way, change the direction in the program.

Plan the whole movement

Include a stop instruction for a spinning motor. Starting it and then waiting leaves it running throughout the wait. For a three-second journey, start, pause 3,000 ms, then stop.

Follow the kit's motor connections and power setup. Motors may need an extra motor board. Keep fingers, hair, and loose clothes away from spinning parts. Support a buggy during a table test so it cannot drive over the edge.

Key Takeaways

  • A spinning motor controls speed and direction.
  • A servo moves to an angle and holds it.
  • A buggy turns toward its slower side.
  • Waiting does not stop a motor.
  • Use the kit’s motor board and power setup.
3

Read buttons and sensors

Buttons tell a board what someone chooses. Sensors tell it about the world around it. You will find out how presses and readings reach your program, then save useful information in variables. A count or a saved reading helps your device remember what happened earlier.

3.1 Make a press do the right thing

A button tells your program whether it is pressed. Choosing how to read it changes what your device does when someone holds it down.

Two states, different switches

A button has two states: pressed and not pressed. A push-to-make switch, like a doorbell button, connects only while pressed. A toggle switch stays where you put it until you flip it again.

Buttons let people control a device. One button could choose a game mode. Another could clear a display or silence a sound.

Once per press or while held?
What you wantProgram choice
One action for each pressA button event
An action while the button is heldA button check inside a loop

An event block responds when something happens. In a quiz buzzer, "on button A pressed" can show a happy face and play one beep. Button B can clear the screen. Holding A does not turn its event into a repeating loop.

A condition asks about the button's state at that moment. To run a fan while A is held, use a forever loop:

forever:
  if button A is pressed:
    motor on
  else:
    motor off

The loop keeps asking. When you release A, the next check takes the else path. Without "motor off", the fan can keep spinning after release.

Count presses carefully

If "change score by 1" sits in a button event, one press adds one. If it sits inside a fast loop's held-button check, one long hold can add many points. Every round finds the button still pressed and adds again.

A check in "on start" has a different problem. It checks only when the board starts. A press several seconds later arrives after that check has finished.

Touch can be input too

Some boards can detect buttons A and B together. Others also offer a touch-sensitive logo or pins. With a suitable kit, foil or fruit connected by clips can become touch pads. A touch pad gives the program input; the display or sound is the output that responds.

Key Takeaways

  • Use an event for one action per press.
  • Use a repeated check for an action while held.
  • A push-to-make switch releases; a toggle switch keeps its position.
  • Touch pads can provide input.

3.2 Find out what your sensor measures

A sensor turns something in the world into a reading. Before choosing what your device should do, find out what those numbers mean in its real location.

Match the sensor to the job
What you need to noticeUseful sensor
BrightnessLight sensor
TemperatureTemperature sensor
Noise levelMicrophone or sound sensor
Wetness of soilMoisture sensor
How far away an object isDistance sensor
Shaking or tiltingAccelerometer
Direction the board facesCompass

An accelerometer measures acceleration, including the effect of gravity. A board uses this information to detect movement and tilt. Blocks such as "on shake" use that sensor's readings.

Read numbers before choosing a rule

On a micro:bit, light readings run from 0 for dark to 255 for bright. The sensor supplies a number, not the word "dark". A program compares that number with a threshold to choose an action.

Try this for a night light:

  1. Show the light reading while the room is bright: about 140.
  2. Cover the sensor and read again: about 15.
  3. Choose a threshold between them, such as 50.
  4. Use "light level < 50" to decide when to shine.

The reading 15 is below 50. The reading 140 is above it. A threshold of 5 would miss both situations, so the light would never come on during these tests.

Expect small changes

Readings might wobble from 140 to 142 to 139. Small changes are normal. A threshold right beside those values can make an output switch back and forth. Choose a value with space between the usual readings for your two situations.

The same threshold may fail somewhere else. Sunlight near a window can reach a partly covered sensor. Check it where the finished device will sit.

Temperature needs a little care

Classroom boards commonly report temperature in degrees Celsius, or °C. Water freezes at about 0 °C; a classroom might be near 20 °C. Some boards measure inside their computer chip. That chip can warm up while running, so its reading can be warmer than the surrounding air. A reading tells you what that sensor measured, in that place.

Key Takeaways

  • Choose the sensor for the thing you need to measure.
  • A sensor reading is a number your program can compare.
  • Choose thresholds using real readings.
  • Small reading changes are normal.
  • Test the sensor in the device’s real location.

3.3 Remember a count or a reading

A board can remember information while your program runs. A variable is a named place in memory that holds a value you can change.

Build a step counter

Name a variable "steps". Put "set steps to 0" in "on start". Add these events:

  • On shake: change steps by 1.
  • On button A pressed: show the value of steps.
  • On button B pressed: set steps to 0.

After three shakes, steps holds 3. Button A shows 3. Button B clears the count. The word "steps" is the name; 3 is the value. "Show text steps" displays the name, not the count.

Keep the starting instruction out of forever. Resetting steps every round erases the count again and again. Test by walking exactly 20 steps. A display of 26 means extra movements were counted; 14 means some steps were missed. Try changing where you wear it or how strong a shake must be.

Save a moment

"Set temp to temperature" saves the reading now. If temp becomes 21, it stays 21 until another instruction changes it. It does not follow the sensor by itself.

To keep the highest reading, begin with the first reading. For each new value, use:

if reading > highest:
  set highest to reading

With readings 21, 23, and 22, highest starts at 21. It changes to 23 because 23 is larger. It stays at 23 when 22 arrives.

Make a setting adjustable

A variable can hold a threshold too. Start threshold at 50. Button A adds 10; button B subtracts 10. Compare light with the variable threshold. Someone can tune the night light without changing its blocks.

If the comparison still contains a fixed 50, changing the variable will do nothing.

Save readings over time

A data logger collects and saves readings at regular times. Taking a reading every five seconds for one minute gives 12 readings, when the first is at five seconds. A table or graph can show how they changed.

Choose the gap to match the change. Moving a board happens quickly, so readings need to be close together. A room cooling overnight changes slowly, so a gap of several minutes can work.

Key Takeaways

  • Set a starting count once, then change it when events happen.
  • A saved reading stays until you update it.
  • Keep a highest value by replacing it only with a larger reading.
  • Use a variable in the comparison to make a setting adjustable.
  • A data logger saves readings at regular times.
  • Choose the reading gap to suit how fast things change.
4

Write control programs that decide

Your device needs to notice changes after it starts. You will place checks inside loops, turn readings into true-or-false choices, and handle several conditions. Testing a value exactly at a boundary helps you see whether your program does the job you intended.

4.1 Keep your device checking

A room can become darker after a board starts. Your program needs to check again to notice the change. The place you put each instruction matters.

Set up once, then keep watching

Use "on start" for setup. It can set a count to zero, display a welcome picture, or close a model gate. It runs when the board starts or resets.

Use "forever" to keep reading inputs and setting outputs. A typical round reads a sensor, makes a decision, and changes an output. Event blocks can also respond whenever their event happens.

A plant alarm might repeat these steps:

  1. Read the moisture sensor.
  2. If the soil is dry, show a sad face and beep.
  3. Else, show a happy face.
  4. Pause for 1,000 ms.

It checks about once each second. The reading belongs inside the loop too. Reading once at startup and comparing that old number forever would miss new conditions.

Repeat a set number of times

A "repeat" loop finishes after its chosen number of rounds. To flash a warning three times, repeat: LED on, pause 200 ms, LED off, pause 200 ms.

Each round waits 400 ms. Three rounds wait 1,200 ms, or 1.2 seconds. After the third round, the program moves to the block below the loop. A forever loop would keep flashing.

Waiting affects checking

A pause holds up the instructions in that loop. During a ten-second pause, that loop does not check its sensor or button again. A short press can happen and finish between checks. Other event blocks can still run in editors that handle events separately.

A "repeat until" loop checks its condition between rounds. It leaves the loop when a check finds the condition true. If it checks whether A is held, A must be held at the time of a check.

Give an output one clear rule

Two forever loops can fight over the same light. One turns it on; the other turns it off. The light can flicker as their instructions take turns. Put the choices in one place, with a condition that selects the intended state.

Key Takeaways

  • Put setup in "on start" and repeated reading inside a loop.
  • A repeat loop finishes; a forever loop keeps running.
  • A paused loop does not check its inputs.
  • A repeat-until loop checks between rounds.
  • Control an output from one clear set of choices.

4.2 Tell your device what to do in both cases

A sensor gives a number. A condition turns a comparison into true or false. Your program uses that answer to choose an action.

Read the comparison aloud
SignRead it as
<Less than
>Greater than
=Equal to
≤Less than or equal to
≥Greater than or equal to

The threshold is the number where the behavior changes. Use real sensor readings to choose it.

Make a night light respond both ways

Use this decision inside forever:

if light level < 50:
  turn LEDs on
else:
  turn LEDs off

At 15, the condition is true, so the LEDs turn on. At 140, it is false, so they turn off. This choice is called selection.

Now follow a change: first the room is dark, then bright. The first check turns the LEDs on. The next bright check reaches else and switches them off. If you leave out else, no instruction turns them off. The earlier on state remains.

Test the exact threshold

At a reading of 50, "less than 50" is false. The LEDs turn off. To include 50 in the on case, use "less than or equal to 50". Decide which behavior you need before choosing the sign.

A useful set of tests is 49, 50, and 51. These readings check just below, exactly at, and just above the boundary. A very dark and a very bright test alone can miss an incorrect equals sign.

Check the direction

A too-hot warning can use "temperature > 30". At 31 °C it shows "HOT" and plays a tone. At exactly 30 °C it shows "OK". Greater than does not include equality.

For a night light, "light > 50" would reverse the job. It would shine in the bright case. Say the whole rule aloud: "If the light reading is less than 50, turn on." This helps you connect the sign to the action.

Buttons can supply conditions too. "If A is pressed, motor on; else, motor off" chooses a state on every check, using the button's two states.

Key Takeaways

  • A condition has a true or false answer.
  • If and else give actions for both answers.
  • Strict < and > comparisons leave out equality.
  • Test the exact threshold and values beside it.

4.3 Choose between more than two actions

Some devices need three choices or two clues at once. You can join conditions and order decisions so the output matches each situation.

Follow an else-if chain

An else-if chain checks from the top. The first true branch runs. The later branches are skipped.

if temperature < 18:
  show "COLD"
else if temperature > 25:
  show "HOT"
else:
  show "OK"

A reading of 17 reaches "COLD". At 18, the first check is false. The second check is false too, so it shows "OK". A reading of 25 also shows "OK"; 26 shows "HOT". The middle range includes both 18 and 25.

Put a stricter check first

Consider "if temperature > 10, show WARM; else if temperature > 25, show HOT". At 30, the first check is already true. The program shows "WARM" and skips "HOT".

Check "greater than 25" first, then "greater than 10". A high reading can now reach "HOT". Separate if blocks behave differently: both can run and change the same display. Use one chain when only one choice should happen.

Join clues with and or or

And needs both conditions to be true. A garden light might require darkness and someone nearby. Use "light < 50 and distance < 100 cm".

Light and distanceShine?
Dark and nearYes
Dark and farNo
Bright and nearNo
Bright and farNo

Or needs at least one condition to be true. A model alarm can beep if a door opens or a window opens. It beeps when either opens, and also when both open.

Check a range

To ask whether temperature is from 18 to 25, use "temperature ≥ 18 and temperature ≤ 25". A reading of 20 passes both checks. At 27, the upper check fails.

Using or here would accept every reading: even 40 is at least 18. Test both ends and a value outside each end. For the three-message thermometer, test 17, 18, 25, and 26 to reach all branches and check both boundaries.

Key Takeaways

  • An else-if chain runs its first true branch.
  • Check a stricter overlapping condition first.
  • And needs both conditions; or needs at least one.
  • Use and to keep a value between two limits.
  • Test every branch and both sides of each boundary.
5

Design, build and test a device that solves a problem

A useful device has a clear job for a real person. You will turn that job into a plan, connect and program the parts, and test the finished model. A written test result helps you find a fault and choose one change that makes the device work better.

5.1 Plan a useful device

A smart device starts with someone's need. Before you choose blocks or parts, decide who will use it and what problem it should solve.

Write things you can check

Design criteria say what a successful device must do. "Make a good light" is hard to test. "The light turns on within two seconds of darkness" gives you a clear check. Ask where the device will sit and how people will control it.

Start with a simple version. Add extra features after its main job works. A device with many unfinished features may never solve the original problem.

Plan a plant reminder

The class plant keeps drying out. You want a reminder that tells someone to water it.

StagePlan
InputMoisture sensor in the soil
ProcessCheck every ten minutes; compare with the dry threshold
OutputSad face and short beep when dry; happy face otherwise
Human controlA button silences the beep until watering

First explore the sensor in wet and dry soil. Use those readings to choose the threshold. A number that works for one moisture sensor may mean something different on another.

The silence button needs a remembered setting. Once pressed, the program keeps the beep silent while the soil stays dry. When watering is detected, it clears that setting for next time. Otherwise, a single press could silence every future warning.

Draw or write the algorithm

An algorithm is the steps your program follows. Write numbered steps or draw a flowchart. In a flowchart, an oval marks the start. A rectangle shows an action. A diamond asks a yes-or-no question. Labeled arrows show which path to follow, and an arrow back shows repetition.

For a model gate, the plan might be: check for an animal nearby; open the gate; wait ten seconds; close; return to the check. A servo supplies the two positions. Try the plan with a toy animal before building the model.

Think about difficult moments

What happens if both buttons are pressed? What if a reading equals the threshold? Can the user stop the device? Add tests for these cases to your plan. A greenhouse logger, a door alarm, and a buggy that stops near walls all need different inputs and different checks.

Key Takeaways

  • Begin with the user, place, and problem.
  • Write criteria you can test.
  • Match inputs and outputs to the job.
  • Plan decisions and repeats before coding.
  • Build the main feature before adding extras.

5.2 Send your program to the real board

The simulator can help you try your blocks. The real device also needs matching connections, power, and the newest copy of your program.

Connect with care

Switch off or unplug power before changing connections. Keep electronics dry and use the battery pack supplied with your kit. Tell an adult if anything gets hot, smells strange, or has a damaged battery.

Follow your kit's connection pictures. Match the labeled pins or sockets to the program. Some boards use numbers such as 0, 1, and 2; others use letters. Power and ground have their own labels. Ground is often marked "GND" or "−".

Some parts, including many LEDs, work only one way around. Match the kit's + and − markings. Fasten clips firmly and keep their metal ends apart. Touching clips can connect places that should stay separate.

Match the pin in the program

An LED is connected to pin 1. The program says "turn pin 0 on". The program can run without reporting an error, but the LED stays dark.

  1. Find the LED's connection in the kit plan.
  2. Read its pin label: 1.
  3. Change the output block to pin 1.
  4. Send the changed program to the board.

The hardware connection and software instruction now point to the same place.

Download and try it

To download a program means to send it to the board. Many boards use a USB cable; some also support Bluetooth. A saved change in your editor does not update the board until you send it again.

Try a tiny program first, such as showing a heart. Check that the real board runs it. Then send your device program. Most classroom boards keep their program after unplugging and run it again when powered.

Build around the parts

Keep a light sensor uncovered. Place moisture-sensor prongs in the soil. Fix a motor firmly and leave enough wire for moving parts. A sensor hidden by your model's roof cannot measure the light you intended.

A simulator is an on-screen model. It helps check program logic, but its readings and movement can differ from the real device. A heavier gate may move slowly. A bright window may change the sensor readings. Test the model where people will use it.

Key Takeaways

  • Follow the kit’s connection plan and match pin labels.
  • Send the program again after editing it.
  • Try a tiny program to check the real board.
  • Place parts so they can sense and move freely.

5.3 Test, find the fault, and improve

A device working once is a useful start. Testing checks whether it does its job in different situations, including the awkward ones.

Compare expected and actual results

The expected result is what should happen. The actual result is what did happen. Write both so you can explain a pass or failure.

For a night light using "light < 50", a test table might look like this:

TestExpected result
Cover sensor; reading about 15LEDs on
Uncover sensor; reading about 140LEDs off
Give a reading of exactly 50LEDs off
Cover, then uncoverOn, then off

Add an actual-result column when you run the tests. The last test checks a change over time. It can reveal a missing else that two separate startup tests miss.

Test every input and every branch. Include values at boundaries and actions such as holding a button or pressing both buttons. Use the real location as well as the simulator.

Find one cause at a time

A fault, or bug, makes the actual result differ from the expected one. It can be hardware or software.

  • Hardware: loose clip, wrong pin, low battery, backward part, covered sensor.
  • Software: wrong comparison, missing else, old program, poor threshold, check outside a loop.

Use a clear search order:

  1. Describe exactly what fails and when.
  2. Check power and whether the latest program was sent.
  3. Match each connection to the plan.
  4. Test one part with a tiny program.
  5. Display sensor readings and check the decision rule.
  6. Change one thing, then repeat the failed test.
Use readings to explain a failure

A night light never turns on. Its covered reading is 70, and uncovered is 160. The program uses "light < 50". Both readings fail that condition.

Try a threshold of 110. Now 70 passes and 160 fails. Test both situations again. Changing the threshold explains this fault; replacing several parts at once would hide which change helped.

Judge the finished device

To evaluate, compare the device with each design criterion. Ask its users to try it. A bright warning might work well for one person but be hidden from another's seat. Use their feedback and your results to choose the next improvement.

Key Takeaways

  • Record what should happen and what actually happened.
  • Test changes over time, boundaries, and every branch.
  • Faults can be in hardware or software.
  • Use tiny programs and visible readings to narrow down a fault.
  • Change one thing and test again.
  • Evaluate against the criteria and ask users to try the device.

Physical Computing examples

5 Walkthroughs

1

Follow a machine’s hidden computer

9 steps
Trace how a machine senses, follows its program, and acts.
  1. 1
    IntroductionA machine notices you

    An automatic door opens as you approach. You do not turn a handle, but several parts work together. A hidden embedded computer controls it.

    Follow the information from the approaching person (input), through the program (processing), to the moving door (output). Then use the same ideas to explain another device.

  2. 2
    ExplanationLook inside the machine

    An embedded computer is built into a machine to control it. A washing machine and a robot vacuum both have one. Your classroom board also runs a program. Its microcontroller is a tiny computer on one chip, with connections for other parts on the board.

  3. 3
    ExampleFind the moving part

    At the store, a sensor notices you nearby. The computer follows its opening rule. A motor slides the door open. The computer did not invent that rule: someone wrote it. A mistake in the program can make the machine behave wrongly.

  4. 4
    ChallengeChange the door’s wait

    The same automatic door should wait longer before closing. Its motor and sensor work. Should you change its hardware or software, and why?

    ---reveal---

    Change the software: the program controls the wait. The working motor and sensor are hardware and can carry out the changed instructions.

  5. 5
    ExplanationGive each part a job

    Input gives information to the computer. Processing follows the program and chooses an action. Output carries it out. For the door, sensing a nearby person supplies input, the program processes it, and the motor provides movement as output.

  6. 6
    AnalogyKeep a note for later

    Think of storage like keeping a note you can use later. A board stores its program and useful values. A counter remembers the earlier number before adding another event. The name of the store helps the program find that value again.

  7. 7
    ChallengeSort a toy’s parts

    A toy hears a clap and shows a smile. It has a microphone, a computer running a rule, a display, and a battery. Which supplies input, and which supplies power?

    ---reveal---

    The microphone supplies input about sound. The battery supplies power. The display gives output after the computer processes the clap information.

  8. 8
    ChallengeAdd a person’s choice

    The clap toy should let you choose how loud a clap must be. What human control could you add, and which part of the system would use the setting?

    ---reveal---

    Buttons could raise or lower the chosen limit. The program would use that setting during processing, when it compares the microphone reading. The display could stay as the output.

  9. 9
    RecapTrace before you build

    To explain a device, name what it notices, what its program decides, and what acts. Include values it remembers and choices people control. A machine does not need a screen to have a computer; look at the work its parts do together.

2

Build signals with light, sound, and movement

13 steps
Work through a blinking beacon, a greeting, and a moving flag.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionMake your board send a message
  2. 2
    ExplanationHold a light state
  3. 3
    ExampleBuild one beacon cycle
  4. 4
    ChallengeFix the disappearing flash
  5. 5
    ExplanationChoose pitch and duration
  6. 6
    ExampleTime a greeting with a picture
  7. 7
    ChallengeMake a different note
  8. 8
    ExplanationMove to a flag position
  9. 9
    ExampleRaise the flag
  10. 10
    ExampleFinish the movement
  11. 11
    ChallengeChoose a wheel’s finish
  12. 12
    ChallengeFollow the station signal
  13. 13
    RecapCheck what keeps going
3

Make a badge notice and remember

15 steps
Use presses, sensor readings, and variables to build a responsive badge.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionGive a badge useful inputs
  2. 2
    ExplanationRead a press once
  3. 3
    ExampleKeep checking a held button
  4. 4
    ChallengeChoose a foil-pad action
  5. 5
    ExplanationMatch a reading to its meaning
  6. 6
    ExampleCollect two groups of readings
  7. 7
    ExampleChoose a useful boundary
  8. 8
    ChallengeChoose a sensor for a new job
  9. 9
    AnalogyGive a value a name
  10. 10
    ExampleStart a movement count
  11. 11
    ExampleSave one reading
  12. 12
    ChallengeFollow the remembered maximum
  13. 13
    ConnectionMake a record over time
  14. 14
    ChallengeGive the badge a tuning button
  15. 15
    RecapKeep the right information
4

Make a changing-room indicator

14 steps
Build a control program that keeps checking and chooses the right message.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionNotice when a room changes
  2. 2
    ExplanationUse startup for setup
  3. 3
    ExampleChoose the gap between checks
  4. 4
    ChallengeFind the stale reading
  5. 5
    ExplanationChoose true or false
  6. 6
    ExampleFollow a changing input
  7. 7
    ChallengeTest the exact limit
  8. 8
    ExampleAdd a cold message
  9. 9
    Key InsightKeep equality in the middle
  10. 10
    ChallengeRepair the order
  11. 11
    ExplanationJoin two clues
  12. 12
    ChallengeCheck a middle range
  13. 13
    ChallengeFollow the complete indicator
  14. 14
    RecapTry the paths that meet at a boundary
5

Plan and test a shelf reminder

12 steps
Take a model device from a user’s need through real-world tests and improvements.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionBuild for a real place
  2. 2
    ExplanationChoose a clear success test
  3. 3
    ExamplePlan the information path
  4. 4
    ChallengeImprove a vague requirement
  5. 5
    ExampleMatch the connection plan
  6. 6
    TipSend each edited version
  7. 7
    ChallengeLet the sensor do its job
  8. 8
    ExampleWrite down both results
  9. 9
    ExampleUse evidence to find a fault
  10. 10
    ChallengeChoose a useful retest
  11. 11
    ChallengeChoose the next improvement
  12. 12
    RecapLet test results guide the next change

Physical Computing practice questions

50 Practice Questions in 5 sets

Set 1: Follow signals and simple programs10 Practice Questions

Question 1 of 10

A washing machine runs a saved wash program without a screen. How can it follow those steps?
  1. The user must keep choosing each step by hand.
  2. An embedded computer runs instructions inside it.
  3. Its motor stores and reads the wash instructions.
  4. Its buttons do the processing for each wash step.
Show answerHide answer
Answer: B
An embedded computer runs the program inside the machine. It can control the wash without a screen or keyboard. The motor supplies movement; it does not store and read the wash instructions.

Question 2 of 10

A model bridge lights a lamp when a boat approaches. What is the lamp’s role?
  1. Input device
  2. Storage device
  3. Processing device
  4. Output device
Show answerHide answer
Answer: D
The lamp carries out an action chosen by the computer: it shines. That makes it an output device. The part that notices the approaching boat supplies input; the lamp does not do that job.

Question 3 of 10

Your LED program repeats "on; pause 300 ms; off; pause 700 ms". How long is one full blink cycle?
  1. 1 second
  2. 0.3 seconds
  3. 0.7 seconds
  4. 2 seconds
Show answerHide answer
Answer: A
The cycle includes both waits: 300 ms plus 700 ms makes 1,000 ms. That is one second. Counting only the 300 ms wait measures the on part, not the full on-and-off cycle.

Question 4 of 10

A greeting tone should sound higher without lasting longer. What should you increase?
  1. Its duration
  2. Its pause afterward
  3. Its frequency
  4. Its number of repeats
Show answerHide answer
Answer: C
Frequency controls how high or low a tone sounds. Raising it makes the greeting higher in pitch. Increasing duration would make the tone last longer, without choosing a higher pitch.

Question 5 of 10

A score increases many times while you hold A once. The program adds one whenever a forever loop finds A pressed. How can one press add just one point?
  1. Put the addition in "on start"
  2. Remove the button condition entirely
  3. Put the addition in a button event
  4. Add zero in the forever loop
Show answerHide answer
Answer: C
A button event runs the addition once for each press. The loop repeatedly finds the held button pressed, so it repeatedly adds points. Moving the addition to "on start" would add only when the board starts, missing later presses.

Question 6 of 10

You want a badge to react when you tilt it. Which sensor fits that job?
  1. An accelerometer
  2. A light sensor
  3. A moisture sensor
  4. A temperature sensor
Show answerHide answer
Answer: A
An accelerometer provides information the board can use to detect tilt and movement. A light sensor measures brightness instead. Tilting might change the light reaching a board, but brightness does not reliably tell it which way it is tilted.

Question 7 of 10

A board checks brightness once at startup. It keeps showing that number as the room gets darker. What needs to move inside forever?
  1. The instruction that shows the saved value
  2. The instruction that sets the start value
  3. The instruction that pauses the program
  4. The instruction that reads brightness
Show answerHide answer
Answer: D
The program needs a fresh reading each round to notice darkness. Repeating the display instruction alone keeps showing the saved startup value. Put the sensor-reading instruction inside forever so the displayed value can update.

Question 8 of 10

A warning uses "if temperature > 28 then show HOT, else show OK". What appears at exactly 28 °C?
  1. "HOT"
  2. "OK"
  3. Both messages
  4. Nothing at all
Show answerHide answer
Answer: B
Exactly 28 is not greater than 28, so the condition is false and else shows "OK". Showing "HOT" would fit a greater-than-or-equal-to rule. The program uses a strict greater-than sign.

Question 9 of 10

Your classroom needs a reminder when noise gets too loud. Which design criterion can you test clearly?
  1. Show a warning within two seconds of loud noise.
  2. Make a warning that everybody thinks looks good.
  3. Use a board that has several interesting features.
  4. Choose a sound that feels suitable for a classroom.
Show answerHide answer
Answer: A
The two-second limit gives you a result you can time and check. "Looks good" depends on an opinion and gives no clear pass condition. The criterion should describe what the reminder must do for its users.

Question 10 of 10

A badge’s old program shows a square. Its edited program sets a count to 1 on startup. A adds 2, then shows a star if count > 4, or a heart otherwise. The board still shows a square. After sending the edit and pressing A twice, what picture appears after each press?
  1. A star, then a star.
  2. A heart, then a heart.
  3. A square, then a square.
  4. A heart, then a star.
Show answerHide answer
Answer: D
Sending the edit replaces the square program and starts the count at 1. The two presses make it 3, then 5, so the display shows a heart, then a star. Showing a star both times misses that 3 is not greater than 4.
Set 2: Choose parts and trace changing values10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

Two toy buggies move. One follows remote-control buttons. The other senses a box and turns away. What makes the second act like a robot?
  1. It receives its direction from a handheld remote.
  2. It has moving wheels attached to a powered motor.
  3. It uses sensed information to choose its movement.
  4. It moves whenever someone gives a steering command.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A model owl’s head must point to a chosen angle and stay there. What output fits?
  1. A servo motor
  2. A spinning wheel motor
  3. A sound buzzer
  4. An LED display
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A display shows a tree, pauses for two seconds, then shows a moon. There is no clear-screen block. What is visible during the pause?
  1. The moon
  2. The tree
  3. A blank display
  4. Both pictures together
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A tally starts at 0. A press adds 1; B resets it to 0. You press A, A, B, A, A, A. What value remains?
  1. 2
  2. 5
  3. 6
  4. 3
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A cupboard sensor gives 20–24 when closed and 150–155 when open. Your warning should turn on when it opens. Which rule separates the readings?
  1. Warn when the light reading is less than 90.
  2. Warn when the light reading is greater than 160.
  3. Warn when the light reading is less than 15.
  4. Warn when the light reading is greater than 90.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A thermometer uses "if temp > 12 show MILD; else if temp > 27 show HOT; else show COOL". Test readings are 9, 20, and 32. Which messages appear in that order?
  1. COOL, MILD, HOT
  2. COOL, MILD, MILD
  3. MILD, MILD, HOT
  4. COOL, HOT, HOT
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

For "if distance < 45 then stop, else move", what happens at 44 cm?
  1. The motor stops.
  2. The motor moves.
  3. The program resets.
  4. The sensor switches off.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A flag device works in the simulator. On the real model, its servo cannot move the heavy flag fully. Which test best checks whether the flag’s weight is the problem?
  1. A lighter flag in the simulator
  2. The original flag in the simulator
  3. A lighter flag on the real model
  4. The original flag with a shorter wait
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

In a flowchart for a parcel alarm, which shape should hold "Is a parcel near?"
  1. A rectangle
  2. A diamond
  3. A start oval
  4. An arrow
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A loop pauses 1,500 ms, checks whether A is held, then pauses 2,500 ms before repeating. You hold A from second 1 to 2, and again from second 4 to 5. Ignoring block-running time, what do the first two checks find?
  1. First held, then released.
  2. First released, then held.
  3. Both held.
  4. Both released.
Show answerHide answer

Save this lesson to see this answer.

Set 3: Predict responses and find missing steps10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A toy oven remembers your chosen cooking time. Which system job keeps that value available?
  1. Input
  2. Output
  3. Power supply
  4. Storage
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A program starts a three-second sound "in background", then lights a blue LED. When can the LED light?
  1. Only after the sound finishes
  2. Only before the sound starts
  3. While the sound is still playing
  4. Only after three more seconds
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

Both buggy wheels move forward. The left wheel slows down while the right keeps its speed. Which way does the buggy turn?
  1. Toward the left
  2. Toward the right
  3. Straight forward
  4. Straight backward
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A model fan starts when A is pressed, but stays on after release. Its loop contains only "if A is pressed, motor on". What instruction is missing?
  1. "On start, motor on"
  2. "Else, motor off"
  3. "If A is pressed, pause"
  4. "On start, show A"
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A counter starts at 0. A adds 2; B resets to 0. A separate button shows the value without changing it. You press A, A, show, B, A, show, A. What do the two displays show, and what value is left?
  1. Displays 4 and 2; ends at 4.
  2. Displays 4 and 2; ends at 2.
  3. Displays 4 and 6; ends at 8.
  4. Displays 2 and 2; ends at 4.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A reading should count as comfortable from 16 through 24 °C. Sam uses "temp ≥ 16 or temp ≤ 24". What happens at 10 and 30 °C, and what join fixes the rule?
  1. Neither passes; change or to and.
  2. Only 10 passes; keep using or.
  3. Both pass; change or to and.
  4. Only 30 passes; keep using or.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

An arrival light should shine for distances of 60 cm or less. Which condition includes exactly 60?
  1. distance < 60
  2. distance > 60
  3. distance ≥ 60
  4. distance ≤ 60
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A sensor is wired to socket C. The program reads socket B. What input instruction matches the real connection?
  1. Read the sensor at socket B.
  2. Read the sensor at socket C.
  3. Set an output at socket C.
  4. Set an output at socket B.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

An alert should shine in dim light and turn off in bright light. Its loop turns it on below 75 but has no else. Tests use 30, then 130 without a reset. What happens, and what fixes it?
  1. It turns off; add an off instruction in else.
  2. It stays on; add an on instruction in else.
  3. It stays on; add an off instruction in else.
  4. It stays on; repeat the same if block twice.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

You want to record how wet the soil becomes after watering. What sensor should you choose?
  1. A distance sensor
  2. A moisture sensor
  3. A sound sensor
  4. A light sensor
Show answerHide answer

Save this lesson to see this answer.

Set 4: Trace a whole device from start to finish10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

You change the blocks so a board shows a leaf instead of a star. The board and its parts stay the same. What did you change?
  1. The hardware
  2. The software
  3. The power supply
  4. The input device
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A locker program saves its first distance reading in "saved". Its loop shows red if saved < 40, or blue otherwise. It also beeps if the current distance is below 20. Readings arrive as 80, 15, and 55 cm. What light and sound occur in those three rounds?
  1. Blue and silent; blue and beep; blue and silent.
  2. Blue and silent; red and beep; blue and silent.
  3. Blue and silent; blue and silent; blue and silent.
  4. Blue and silent; blue and beep; blue and beep.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A signal repeats four times: light on, pause 150 ms, light off, pause 350 ms. Then a separate red light turns on. Ignoring block-running time, when does the red light turn on, and how long was the first light on altogether?
  1. After 2 seconds; on for 1,400 ms.
  2. After 600 ms; on for 600 ms.
  3. After 2 seconds; on for 600 ms.
  4. After 1,400 ms; on for 2 seconds.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A robot must show a smile only after its greeting tune finishes. The smile currently appears during the tune. What change fits?
  1. Use "play in background" before the smile.
  2. Raise the tune’s frequency before the smile.
  3. Put the smile block before the tune starts.
  4. Use "play until done" before the smile.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A wheel starts forward at 40%, then the program pauses for two seconds and ends. What instruction is needed to make the wheel stop after those two seconds?
  1. Set motor speed to 0% before the start.
  2. Set motor speed to 40% after the pause.
  3. Place a second pause after the first pause.
  4. Set motor speed to 0% after the pause.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A lamp should shine only while a switch is pressed. The chosen switch stays on after you let go and needs flipping back. What kind would fit the intended hand action?
  1. A push-to-make switch
  2. A toggle switch
  3. A light sensor
  4. A compass sensor
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A board sets highest to its first reading, 17. New readings replace highest only when larger. A saves highest in snapshot; B sets highest to the current reading. Readings arrive as 26, 22, then A, then 19 and B, then 24. What are snapshot and highest at the end?
  1. snapshot 24; highest 24
  2. snapshot 26; highest 24
  3. snapshot 26; highest 26
  4. snapshot 22; highest 24
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A display should blink until A is found held, then show a check mark. Which structure fits?
  1. Repeat forever; then show the check mark afterward.
  2. Check A once at startup; then blink forever.
  3. Repeat until A is held; then show the check mark.
  4. Show the check mark; then begin blinking forever.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A display uses "if light < 65 and distance < 35 show WAIT; else if distance < 35 show HELLO; else show READY". Readings change from light 40, distance 20 to light 90, distance 20, then light 40, distance 50. What appears?
  1. WAIT, READY, HELLO
  2. HELLO, HELLO, READY
  3. WAIT, HELLO, READY
  4. WAIT, WAIT, READY
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

Your reminder must work for a child who cannot hear its beep. What design change helps that user notice the warning?
  1. Add a clear visible warning.
  2. Give the beep a higher pitch.
  3. Make the beep last twice as long.
  4. Repeat the same beep more often.
Show answerHide answer

Save this lesson to see this answer.

Set 5: Solve problems in new device designs10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A child changes a greenhouse device’s warning limit using buttons. What human control role does this show?
  1. Measuring air temperature directly
  2. Replacing the computer’s processor
  3. Choosing a setting for the program
  4. Supplying power to the sensor
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A servo is holding a pointer at 120 degrees. No later instruction changes its position. What does it do?
  1. Keeps spinning through full turns
  2. Returns to zero after one second
  3. Turns backward at 120% speed
  4. Keeps holding that position
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A model’s sound reading wobbles from 58 to 62 in a quiet room. Loud claps give 170–190. Which threshold best separates these tests for "warn if sound > threshold"?
  1. 60
  2. 110
  3. 190
  4. 20
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A logger records every six seconds, starting at second 6. It stops after recording at second 36. Highest starts at the first value. The saved values are 18, 21, 19, 25, 23, 20. At what time does highest last change, and what is it afterward?
  1. At second 24; it stays 25.
  2. At second 36; it ends at 20.
  3. At second 18; it stays 25.
  4. At second 30; it ends at 23.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

At time 0, a loop starts a motor, pauses 2,000 ms, stops it, then repeats a blink twice. Each blink waits 250 ms on and 750 ms off. Next it checks A. Ignoring block-running time, when is A first checked, and when was the motor stopped?
  1. A at 4 seconds; motor at 2 seconds.
  2. A at 2 seconds; motor at 2 seconds.
  3. A at 4 seconds; motor at 4 seconds.
  4. A at 3 seconds; motor at 2 seconds.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A lamp must shine at light readings 72 and below. A test shows it off at exactly 72 but on at 71. The current rule is "light < 72". What comparison fixes this boundary?
  1. light ≥ 72
  2. light ≤ 72
  3. light < 71
  4. light > 71
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A cabinet alarm should warn if either its door or window opens. Its current rule uses and. Tests are: door only open, window only open, both open. What current results do you expect, and what change fixes the alarm?
  1. On, on, off; replace and with or.
  2. Off, on, on; keep the and rule.
  3. On, off, on; keep the and rule.
  4. Off, off, on; replace and with or.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

Your model works on the desk but reads darkness inside its cardboard case, even in a bright room. The case covers the light sensor. What should you change first?
  1. Raise the warning volume setting.
  2. Hide the output LED inside the case.
  3. Leave the light sensor exposed.
  4. Keep downloading the same program.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A light turns on when its reading is below 45. At its new location, covered readings are 60–66 and uncovered readings are 125–132. The LED works in a tiny test. Which next change and test best fit the evidence?
  1. Set the threshold to 60; test covered then uncovered.
  2. Set the threshold to 140; test covered then uncovered.
  3. Set the threshold to 95; test only while covered.
  4. Set the threshold to 95; test covered then uncovered.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A welcome sign must light within one second when A is held and go off after release. Its only loop checks A, chooses on or off, then pauses 3,000 ms. Startup and release tests both pass when done at checks. Which extra test is most useful, and what change can address its likely failure?
  1. Hold A just after a check; lengthen the pause.
  2. Restart while holding A; lengthen the pause.
  3. Hold A just after a check; shorten the pause.
  4. Restart while holding A; move the check to startup.
Show answerHide answer

Save this lesson to see this answer.

Stuck on your own question? Homework Help

Key Terms

63 Key Terms, each with its definition

A

Accelerometer
An accelerometer measures acceleration, including the effect of gravity, helping detect movement and tilt.
The board uses its accelerometer to notice a shake.
Actual result
An actual result is what really happens when you carry out a test.
When "LEDs on" is expected, the actual result "LEDs off" shows that the test failed.
Actuator
An actuator is an output device that makes something move under the computer’s control.
The gate’s servo acts as the actuator that moves the gate.
Algorithm
An algorithm is a set of steps in order for carrying out a task, including choices and repeats.
You write the gate’s algorithm before arranging its program blocks.
And
"And" joins conditions that must both be true for the combined condition to be true.
The garden light needs darkness and a nearby person at the same time.

B

Button state
A button state tells whether a button is pressed or not pressed at a particular moment.
Your loop reads the button state before choosing motor on or off.
Buzzer
A buzzer is an output device that makes sound when the computer controls it.
The buzzer gives one short beep after a correct button press.

C

Condition
A condition is a question with a true-or-false answer that a program can check.
"Is A pressed?" is the condition your fan program checks.
Control program
A control program reads inputs and sets outputs so a device carries out its job.
The control program keeps checking soil moisture and updating the warning.
Counter
A counter is a value a program changes to keep track of how many events have happened.
In a button game, a counter adds one for each button press.

D

Data logger
A data logger takes sensor readings at regular times and saves them for later study.
The greenhouse data logger records how temperature changes overnight.
Design criteria
Design criteria are clear requirements you use to check whether a device solves its problem.
One criterion for a warning device says its warning must appear within two seconds.
Display
A display is an output device that shows pictures, words, or numbers.
The display shows the value of your counter when you press A.
Distance sensor
A distance sensor measures how far away an object is and gives a reading the program can use.
The buggy checks a distance sensor before moving toward a box.
Download
To download a program to a board means to send it from the editor so the board can run it.
After changing a block, you download the new version again.
Duration
Duration is how long something lasts, such as a note or a pause.
Two notes can share a pitch but have different durations.

E

Else branch
An else branch holds instructions that run when an if condition is false.
The else branch turns the lamp off when the room is bright.
Else-if chain
An else-if chain checks choices in order and runs only the first branch whose condition is true.
The thermometer’s chain chooses "COLD", "HOT", or "OK".
Embedded computer
An embedded computer is built into a larger machine to control how it works.
A washing machine’s embedded computer runs its chosen wash cycle.
Evaluation
Evaluation means judging the finished device against its criteria and the needs of its users.
Your evaluation checks whether the plant reminder is easy to notice.
Event
An event is something a program can respond to, such as a button press or a shake.
The button-press event runs one set of doorbell instructions.
Expected result
An expected result is what you predict should happen when you carry out a planned test.
Before a test with a reading of 15, you predict "LEDs on" as your expected result.

F

Fault
A fault is a hardware or software problem that makes a device behave differently from its intended result.
A loose clip can cause a fault even when the program is correct.
Flowchart
A flowchart is a picture of steps and decisions joined by arrows that show their order.
Your flowchart sends "no" from a sensor check back to that same check.
Forever loop
A forever loop repeats its instructions again and again while the board is powered.
The forever loop keeps checking for a person near the gate.
Frequency
Frequency tells how many times a sound vibration repeats each second and is measured in hertz.
Choosing 440 Hz makes a higher tone than choosing 262 Hz.

G

Ground
Ground is a connection point on the board, often labeled "GND" or "−" in a kit’s wiring plan.
You match the sensor’s ground connection to the kit’s picture.

H

Hardware
Hardware is the physical parts of a computer system that you can touch.
The wires, board, and motor are hardware in your buggy.

I

Input
An input is information sent into a computer from a button, sensor, or other input device.
Pressing the alarm’s silence button gives the computer an input.

L

LED
An LED, or light-emitting diode, is a small light that a program can switch on and off.
Your model uses a yellow LED to show the middle traffic-light stage.
Light sensor
A light sensor measures brightness and provides a value the program can compare.
The night light reads its light sensor in the dim hallway.

M

Microcontroller
A microcontroller is a tiny computer on one chip that stores and runs a control program.
The microcontroller follows instructions to open your model gate.
Millisecond
A millisecond is one thousandth of a second, often used to set a program’s waiting time.
A pause of 500 milliseconds lasts half a second.
Moisture sensor
A moisture sensor is an input device that measures how wet something is, such as soil.
The plant reminder uses a moisture sensor in its pot.
Motor
A motor is an output device that makes movement, such as turning a wheel.
Your program starts the fan motor, waits, and then stops it.
Motor speed
Motor speed is how fast a motor turns, often set with a percentage in classroom kits.
You lower the left motor’s speed to make the buggy turn left.

O

On start
"On start" is a program block that runs once when the board starts or resets.
"On start" puts your step counter at zero before you walk.
Or
"Or" joins conditions so the combined condition is true when at least one is true.
A door-or-window alarm sounds when either opening is detected.
Output
An output is an action or information produced under the computer’s control.
The walk signal and its beep are outputs at a crosswalk.

P

Pause
A pause is an instruction that makes that part of the program wait for a chosen time.
A pause keeps a heart picture on the display before the display changes.
Physical computing
Physical computing means programming devices that sense and act in the real world.
Your board notices a shake and responds by lighting a star.
Pin
A pin is a labeled connection point on a board where a kit can attach another part.
The LED on pin 1 needs a program instruction for pin 1.
Pitch
Pitch is how high or low a sound seems when you hear it.
The doorbell plays a high-pitched note followed by a lower one.
Processing
Processing is the work a computer does as it follows a program and handles information.
When a program compares a light reading with 40, that comparison is part of the processing.
Push-to-make switch
A push-to-make switch makes a connection only while you press it.
Letting go of a doorbell button releases its push-to-make switch.

R

Range check
A range check tests whether a value is between a lower and an upper limit.
A range check can include temperatures from 18 through 25 °C.
Reading
A reading is a value measured by a sensor at a particular moment.
The light reading changes when you cover the board with your hand.
Repeat loop
A repeat loop runs its instructions a chosen number of times, then finishes.
A repeat loop gives four warning flashes before the program moves on.
Reverse
Reverse is the motor direction opposite to the direction called forward.
Running both buggy motors in reverse makes the buggy move backward.
Robot
A robot is a machine that senses and acts by following a program to control its behavior.
A robot buggy detects a box and steers away without your steering it.

S

Saved reading
A saved reading is a sensor value kept from one moment until the program replaces it.
The saved reading stays at 22 even after the next sensor reading rises.
Selection
Selection means choosing which instructions run according to whether a condition is true or false.
Selection makes your warning choose between "HOT" and "OK".
Sensor
A sensor is an input device that measures something about the world for a program.
A sensor measures the conditions before your board chooses a response.
Servo
A position servo is a motor that turns to a chosen angle and holds that position.
The servo points your model arrow to 90 degrees.
Simulator
A simulator is an on-screen model that lets you try a device’s program before testing its real parts.
A simulator helps you check a program’s choices before you connect its real parts.
Software
Software is the program of instructions that tells the computer what to do.
Changing the blocks changes the software that controls your light.
Storage
Storage keeps programs or values available so the computer can use them later.
Keeping the step count lets the board add the next detected step.
System
A system is a set of parts that work together to do a job.
The door’s sensor, computer, and motor work together as a system.

T

Temperature sensor
A temperature sensor measures how hot or cold something is, often giving readings in °C.
Your logger saves a temperature sensor reading every minute.
Threshold
A threshold is a chosen boundary value used to decide when a device changes its action.
A night light with a threshold of 50 treats readings on one side as bright and readings on the other as dark.
Toggle switch
A toggle switch keeps the position you choose until you move it again.
The model’s toggle stays on after you take your hand away.
Tune
A tune is a sequence of musical notes, each with its own pitch and length.
A board plays a short tune when a reaction game ends.

V

Variable
A variable is a named place in memory holding a value that can change while a program runs.
The variable "steps" holds 7 after seven detected shakes.

About this lesson

By StudeliReport a mistake

Make your own Study Materials

Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.

Get Started