Light Sensor (built-in)
What you'll build¶
The LED matrix can also sense light. Read the ambient light level and scroll Day or Night.
Code¶
| 6 light-level.py | |
|---|---|
How it works¶
display.read_light_level() returns a value from 0 (dark) to 255 (bright). Below 150 the program decides it is night.
Try this next¶
- Scroll the raw light level to find a better threshold for your room.
- Turn the display into a night-light that glows when it gets dark.
- Log light levels over a day with Data Logging.