04micro:bit ยท MakeCode 25 minutes
Onboard light meter
Use the display's own lights to sense brightness.

Lesson goal: Read input.lightLevel() (0 to 255), show it as a bar graph and as a number, and compare places around the room.
Open MakeCodeSection 1
Understand
- light level 0..255
- sensor settling
- bar graph
- relative measurement
- 1The display LEDs also sense light: 0 (dark) to 255 (bright).
- 2It is relative light, not a lux meter.
- 3The first reading may need a moment to settle.
Safety first
- Do not shine a torch or phone light directly into anyone's eyes while testing.