Description
This project is a beginner project to show how to use the sound sensor on the micro:bit to trigger a behavior based on the sound level. We will use the sound sensor to turn the LED array lights on in response to a loud sound, then turn them off when the sound level gets quiet.
Programming Language
MakeCode Blocks
Difficulty Level
Beginner
Age Range
9 and up
Materials
Optional materials:
- BBC micro:bit V2
- 2xAAA battery pack
- USB to MicroUSB cord
Programming the micro:bit
Develop the problem statement
The problem I am trying to solve is getting the lights to turn on when a loud sound is made, then go off when the sound gets quiet.
Write the algorithm
The design of this algorithm is based on events happening, so
- When a loud sound is heard
- show LED icon
- When the sound level is quiet
- Turn the LEDs off
Note that this is a pretty simple algorithm. A more complex algorithm might need to be turned into pseudocode prior to writing the actual computer program.
Write and test the code
Here is the code I wrote