1단계: 만들어 보세요.
Make the new micro:bit's microphone respond to claps and beats with an animated light show.
- 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)
- MakeCode 또는 Python 편집기
- AAA 배터리 팩 (옵션)
2단계: 프로그래밍 해보세요.
3단계: 더 좋게 만들어 보세요.
- 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.