Welcome to Building:bit Superkit repository
1.Buzzer play music
Buzzer plays music
Buzzer plays music1. Learning objectives2. Programming2.1 Add expansion package2.2 Building blocks used2.3 Combined blocks3. Experimental phenomenon
1. Learning objectives
In this course, we mainly learn how to drive the buzzer on the superbit expansion board through MakeCode graphical programming.
The buzzer is located on the expansion board as shown in the figure below.
! Notes:
Before conducting this experiment, we need to connect the jumper cap to the P0 and Buzzer pins on the Super:bit expansion board, as shown in the figure below.
2. Programming
Method 1 Online programming:
First, connect the micro:bit to the computer via a USB data cable. The computer will pop up a U disk. Click the URL in the U disk: https://makecode.microbit.org/ to enter the programming interface. Then, add the Yahboom smart software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
Method 2 Offline programming:
Open the offline programming software MakeCode and enter the programming interface. Click [New] and add the Yahboom smart software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
2.1 Add expansion package
2.2 Building blocks used
The location of the building blocks required for this programming is shown in the figure below.
2.3 Combined blocks
The summary program is shown in the figure below.
You can also directly open the microbit-BuzzerPlayer.hex file provided in this experiment and drag it into the browser that opens the URL, and the program diagram of this project source code will be automatically opened
3. Experimental phenomenon
After the program is successfully downloaded, the micro:bit dot matrix will display the music pattern, as shown in the figure below. At the same time, we can hear the buzzer playing "Birthday".
If you need to restart, please press the reset button on the back of the micro:bit motherboard.