Hello, when we hold birthday parties, the lighting candles come to our mind for best wishes! If we have a micro:bit by hand, is that possible to make an electronic candle device with it? Here comes the case of blowing off the candle “fires” by sound.
The functions we need to achieve:
When the analog value of sound level is less than 80, the onboard led screen displays number “1”, indicating that the sound is small and the loudness is level 1. Otherwise, when the analog value of sound level is bigger than 80, the screen displays the number “2”, Which means the sound is louder, and the loudness is level 2.
Programming
If you want to make an electronic candle, you need to know the microphone placed on the micro:bit V2. The microphone could receive our voice, whether it is loud or small (using the loudness level on the micro:bit to identify), through the level of the sound, we can control the board.
Electronic candles program
Program on MakeCode to achieve the function of controlling the on/off status of the LEDs and download the program to micro:bit V2 board, blowing into the microphone to turn off the LEDs while the sound level reaches at a certain loudness.
Before blowing (making sound), the LEDs are on; when air is blown, the LEDs light off. When the microphone analog value is less than the set value of 80, the LEDs will remain on. On the contrary, when the sound intensity is bigger than 80, the LEDs will remain off for 10 seconds.
Program: https://makecode.microbit.org/_U7zAd8i7oKRK
If you have any ideas or opinions, please feel free to contact us via [email protected].