Welcome to Mini Microbit Handle repository
6.Listen to music
6.Listen to music
1. Learning goals
In this lesson, we will learn to use micro:bit to make a music player, because micro:bit itself does not have audio equipment. We need to install micro:bit on the Wrist:bit watch expansion board and use the buzzer above to play music.
2.Code and analysis from microbit import

from microbit import *
This code is to import everything from the microbit library, and any program need to uses import this library.
List of melody:
• music.DADADADUM
• music.ENTERTAINER
• music.PRELUDE
• music.ODE
• music.NYAN
• music.RINGTONE
• music.FUNK
• music.BLUES
• music.BIRTHDAY
• music.WEDDING
• music.FUNERAL
• music.PUNCHLINE
• music.PYTHON
• music.BADDY
• music.CHASE
• music.BA_DING
• music.WAWAWAWAA
• music.JUMP_UP
• music.JUMP_DOWN
• music.POWER_UP
• music.POWER_DOWN
Note:
1 - The capital letter/lowercase letters must be distinguished!
2 - Correct spelling!
3 - Keywords such as # need a space between the content.
4 - You can only use the Tab key (tabulation key) for indentation.
3. Programming and downloading
3.1 You should open the Mu software, and enter the code in the edit window, , as shown in Figure . Note! All English and symbols should be entered in English, and the last line must be a space.

3.2 As shown in Figure, you need to click the Check button to check if our code has an error. If a line appears with a cursor or an underscore, the program indicating this line is wrong.

3.3 You need to connect the micro data cable to micro:bit and the computer, then click the Flash button to download the program to micro:bit as shown in Figure.

4. Experimental phenomena
After the program is successfully downloaded, the micro: bit dot matrix will display music pattern, and it will play music “dadaum”.