This lesson learns to play built-in music by Python programming. For example: heart.
from microbit import *
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:
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.
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.
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 .
The code of the experiment: 7.Play built-in music.zip
Micro Python Basic Course
- Micro Python Basic Course 1.Hello,World
- Micro Python Basic Course 2: Display built-in image
- Micro Python Basic Course 3: Display custom image
- Micro Python Basic Course 4: Display custom animation
- Micro Python Basic Course 5: Button game
- Micro Python Basic Course 6: Do not touch me
- Micro Python Basic Course 7: Play built-in music
- Micro Python Basic Course 8: micro:bit voice talk