5% OFF Over $19, Code: Elephant5; 10% OFF Over $59, Code: Elephant10

Microbit Python Tutorials 7: Play the custom music Painters

Posted by SuFiona on

Course7-Play the custom music Painters

Learning goals:

In this lesson, you will learn how to play the music "The Painter."


from microbit import *

import music


tune = ["G4:2", "E4:2", "G4:2", "E4:2", "G4:2", "E4:2", "C4:4", "D4:2", "F4:2",

        "E4:2", "D4:2", "G4:4", "E1:4", "G4:2", "E4:2", "G4:2", "E4:2", "G4:2",

        "E4:2", "C4:4", "D4:2", "F4:2", "E4:2", "D4:2", "C4:4", "E1:4", "D4:2",

        "D4:2", "F4:2", "F4:2", "E4:2", "C4:2", "G4:4", "D4:2", "F4:2", "E4:2",

        "D4:2", "G4:4", "E1:4", "G4:2", "E4:2", "G4:2", "E4:2", "G4:2", "E4:2",

        "C4:4", "D4:2", "F4:2", "E4:2", "D4:2", "C4:4"]


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 7-3.


Figure 7-3

4.After downloading the program to micro:bit, you can hear t the music "Painter", and there is a note on the dot matrix as shown in Figure 7-4.blob.png 

Figure 7-4 

The code of the experiment: 7.Play the custom music Painters.rar



Leave a comment

Please note, comments must be approved before they are published