13. Project 8: Fire Alarm¶
Level:
13.1. Part List¶
Flame sensor x 1
Red LED X1
Green LED X1
Multiple Sensors for smart house X1
Multiple Actuators for smart house X1
Connecting Wire X1
micro:bit X1
USB Cable X1
13.2. Description¶
In project 8, you can learn how to use micro:bit to make Alert LED (Red/Green). If the flame is detected, the Red LED will be turned on, the Green LED will be turned off. If there is no flame, Green LED is turned on and Red LED will be turned off.
13.3. Steps¶
Basic (Add block on start) > House (Add block Initialize Smarthon multiple-sensor)
Basic (Add block forever) > Logic (Add block if…then…else) > For if : Logic (Add block 0 = 0, change “0” to House “Get flame”; “=” to “<”; “0” to “300”)
For then: House (Add block Set RED LED to intensity 0, change 0 to 1023)
For then: House (Add block Set Green LED to intensity 0)
For else: House (Add block Set RED LED to intensity 0)
For else: House (Add block Set GREEN LED to intensity 0, change 0 to 1023)
Basic (Add block pause (ms) 100)
13.4. Hardware¶
Download the code and transfer to micro:bit
Plug the micro:bit into Multiple Sensors
Connect Multiple Sensors and Multiple Actuators by connecting wire
Connect the RED LED and GREEN LED module to the corresponding port of the Multiple Actuators
You can test it by lighter * Try to make some blinking of the RED LED and buzzer turned on if there is a fire.