Paso 1: Hazlo
Make the new micro:bit's microphone respond to claps and beats with an animated light show.
Guía de programación
- How computers take inputs, process them using code and create different outputs
- How to use the new micro:bit's built-in microphone sensor to trigger events in your code
- That the micro:bit's microphone can be used to respond to both quiet and loud sounds
- When the microphone detects a loud sound, like a clap, it shows a large heart on the LED display.
- If it detects a quiet sound, for example after your clap has finished, it shows a small heart.
- The effect of this is to create a simple heart animation that responds to claps or strong beats in music.
- new micro:bit with sound (or MakeCode simulator)
- Editor de MakeCode o de Python
- pilas (opcionales)
Paso 2: Prográmalo
Paso 3: Mejóralo
- Create your own animation using other icons or drawing your own pictures.
- Make the micro:bit respond to a loud sound by making a sound of its own. Does this cause any problems? How can you fix them?
- You can change the sound level that triggers a loud sound event. This level is called a threshold. In MakeCode use the 'set loud sound threshold to...' input block to choose different sound levels to make it more or less sensitive to loud sounds.
- In Python, to change the threshold for loud sounds use
microphone.set_threshold(SoundEvent.LOUD, 128)- changing the number 128 to the value you want between 0 and 255.