Welcome to Building:bit Superkit repository
2.3 Emergency light
Emergency light
Emergency light1. Learning objectives2. Building blocks3. Sensor wiring4. Programming4.1 Adding extension packages4.2 Bricks used4.3 Combining blocks5. Experimental Phenomenon
1. Learning objectives
In this course, we mainly learn how to use MakeCode graphical programming to display how to turn lights on and off according to the external light intensity.
2. Building blocks
For detailed steps of building blocks, please refer to the installation drawings of [Assembly Course]--[Photosensitive emergency light] in the materials or the building block installation album.
3. Sensor wiring
The photosensitive module is connected to the P0P3 interface.

4. Programming
Method 1 Online programming:
First, connect micro:bit to the computer via a USB cable, a USB flash drive will pop up on the computer, click the URL in the USB flash drive: https://makecode.microbit.org/ to enter the programming interface. Then, add the Yahboom software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
Method 2 Offline programming:
Open the offline programming software MakeCode and enter the programming interface. Click [New] and add the Yahboom software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
4.1 Adding extension packages


4.2 Bricks used
The locations of the building blocks required for this programming are shown in the figure below.





4.3 Combining blocks
The summary procedure is shown in the figure below.
You can also directly open the Emergency-light.hex file provided in this experiment and drag it into the browser that opens the URL, and the program diagram of this project source code will be automatically opened.
5. Experimental Phenomenon
After the program runs successfully, cover the photosensitive module with your hand and the RGB light on the expansion board will turn on, otherwise the RGB light will turn off.