Light Levels

How dark is it in room 112?

The micro:bit measures light levels using the LED Grids - these are both INPUT and OUTPUT devices

The micro:bit will measure the light level and produce numeric value where 0 is complete darkness and 255 is bright sunlight.

We want to create a variable to store the value returned by the light sensor

On Start
   level = lightlevel 

The first time you use it, this function will say 0. After that, it will say the real light level. This is because the light sensor (the part that can find the light level) has to be turned on first.

when Button B Pressed
    set level = lightlevel
    show number (level)

Now using your hand, your book, or anything else - change the light level and discover how the LED works!!

Get your NETWORK Notebook and make a list of 5 light levels that your micro: bit recorded and the conditions. For example, full light = 255

We can also use the LED's to display a bar chart of the light level

Get with a partner, one person has a notebook and one person has the micro:bit programmed with the bar graph and a working battery pack. Walk around the classroom, outside, to the front door, to the restroom (PLEASE Stay UPSTAIRS) and record where you go - in the order you go there.

At each location hit the B Button to return the specific light level at that location

Final step: on that same piece of paper - identify at least two real world uses for a light sensor and explain WHY it might be important to have a real time result of a light reading.

Last updated