Skip to content
04micro:bit ยท MakeCode 25 minutes

Onboard light meter

Use the display's own lights to sense brightness.

Onboard light meter project
Illustration of the finished idea. Build from the diagram and connection table, not the photo.

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 MakeCode

Section 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.