Programming a physical device

About this lesson: Programming a physical device

In short

A small programmable board has a light sensor. The program reads it in a loop: when it's dark it shows a moon, otherwise a sun. Change the light level.

Programming a physical device

What you'll explore

Sensor input: Light level decides
A small programmable board has a light sensor. The program reads it in a loop: when it's dark it shows a moon, otherwise a sun.
Button input: Count the presses
Button A adds 1 to a counter, B takes 1 away, and both together reset it. The count appears on the LED display. Press the buttons.
Test it: Vary the input, check the output
A temperature alarm shows a cross and sounds above 30 °C.
Check yourself: Inputs and outputs
A device turns on a fan when its temperature sensor reads above 25 °C.

Also in this lesson

  • Common mix-ups
  • Device programs
  • Smart home plan

Words to know

sensor
A device that measures something, such as light or temperature.
input
Data going into a program.
output device
Something controlled by a program, such as an LED or buzzer.
embedded system
A computer built into a device.
threshold
The value where a decision changes.

Sources

  • BBC Bitesize KS3 Computer Science
  • Raspberry Pi Foundation, Computing curriculum resources

An interactive lesson with a live experiment: move the sliders, press the buttons and answer quick questions. 4 short steps and a 6-question quiz. Part of the Family plan. Written and checked by Shalo Lab. Last updated 11 November 2026.

← Prototypes, feedback and better designs · Spreadsheet functions →

All lessons in Term 2 · Computing · Age 13