1. korak: Napravi
Što je to?
Make the new micro:bit's microphone respond to claps and beats with an animated light show.
Vodič za kodiranje
Što ćeš naučiti
- 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
Kako to radi
- 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.
Što ti treba
- novi micro:bit sa zvukom (ili simulator u MakeCodeu)
- Uređivač MakeCode ili Python
- baterije (prema potrebi)
2. korak: Kodiraj
3. korak: Unaprijedi
- 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.