Light Sensor Lesson

Step 1: Program microbit to send two different blink light signals, based on the "atmosphere" around the microbit.

Not only can the programmable LED's display light at different levels, some of the can also detect ambient light around them

lightlevel
\\an existing input on the microbit 
\\returns a number

0 = No Light 255 =All the Light

Program a basic light meter that will measure the current light level and display a number to represent how much light is detected.

When Button B is pressed
    set light = lightlevel
    \\where light is a variable you created
    display light

TIP: The 1st time you hit the B button 0 should be displayed. The first button first actually activates the light level

Test your Skills: Extend your program so that if the light level is less than 100 the microbit scrolls "S O S"

For more information: This lesson was based directly on a project found at https://makecode.microbit.org/reference/input/light-level

Last updated