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

Microbit-Python Course 6.10 Play the custom music Painters

Posted by Fiona Su on

Microbit-Python Course 6.10 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 10-1.

Note! All English and symbols should be entered in English, and the last line must be a space.

image.png Figure 10-1

2. As shown in Figure 10-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 10-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 10-3.


Figure 10-3

4.After downloading the program to micro:bit, the buzzer will play《ODE》,as shown in Figure 10-4.

image.png Figure10-4

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

Buy Yahboom Croco:kit sensor starter kit for micro:bit



Leave a comment

Please note, comments must be approved before they are published