> For the complete documentation index, see [llms.txt](https://computational-thinking-in-room11.gitbook.io/room-112-dhs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://computational-thinking-in-room11.gitbook.io/room-112-dhs/software-development/lighthouse-project/light-sensor.md).

# 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&#x20;

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

![](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-Lpf7e-PhZMkxkNJ0zge%2F-Lpf87hkEl-PnoDD8DSE%2FCapture.PNG?alt=media\&token=3666d11b-8073-4e1b-b3af-2ba6c0659bf0)

## 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&#x20;

![When you hit the B button you should notice the adjustable light meter appears on the top corner of your simulator](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-Lpf7e-PhZMkxkNJ0zge%2F-Lpf9Wt6zTloqy6bGapn%2FCapture.PNG?alt=media\&token=491c77c5-02c0-4f16-ac3d-1c83ed7f6e3c)

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>&#x20;
