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.

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
← Prototypes, feedback and better designs · Spreadsheet functions →