# Night light: a free micro:bit lesson from Maze Education
# https://maze.education/microbit/lessons/night-light
# MicroPython for the micro:bit Python Editor: https://python.microbit.org

# Night light: the lights come on when the room gets dark.
from microbit import *

glow = Image("09990:99999:99999:99999:09990")

while True:
    if display.read_light_level() < 50:
        display.show(glow)
    else:
        display.clear()
    sleep(500)
