Welcome to Tiny:bit Pro repository
6.Play built-in music
Learning goals:
This lesson learns to play built-in music by Python programming. For example: heart.
Code:
from microbit import *
import music
music.play(music.ODE)
We need to import the music library function, and call the built-in music. WEDDING melody from the library, the following is a complete 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
Programming and downloading:
1.You should open the Mu software, and enter the code in the edit window, , as shown in Figure 7-1.
Note! All English and symbols should be entered in English, and the last line must be a space.

Figure 7-1
2.As shown in Figure 7-2, 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.
Figure 7-2
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 2-3.
Figure 7-3
4. After the download is successful, we need to connect P0,GND of micro:bit to head phone by crocodile clip. Then, you can hear that buzzer play ODE .