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



Micro:bit piano board Extended_course 3.5 Music_playing_spectrum

Posted by Fiona Su on

Micro:bit piano board Extended_course 3.5 Music_playing_spectrum

1.Learning goals

In this lesson we mainly learn how to use the music touch return, music button of Yahboom piano expansion package.

By programming, we will make the micro:bit dot matrix displays different patterns by touching the 5 black buttons and 7 write buttons on the piano expansion board. Different tones will show different pattern on the lattice. 

2.Programming method

Mode 1 online programming: First, we need to connect the micro:bit to the computer by USB cable. The computer will pop up a USB flash drive and click on the URL in the USB flash drive: http://microbit.org/ to enter the programming interface. Add the Yahboom package https://github.com/lzty634158/YB_Piano to program.

Mode 2 offline programming: We need to open the offline programming software. After the installation is complete, enter the programming interface, click【New Project】, add Yahboom package:

https://github.com/lzty634158/YB_Piano, you can program.

3.Looking for blocks

The following is the location of the building blocks required for this programming.

image.png 

image.png 

image.png 

image.png 

image.png 

image.png 

How to create a new variable:

image.png 

image.png 

image.png 

4.Combine building block

See the hex file for the summary procedure.

Mode=1 means that the low pitch is played.

Mode=2 means that the middle pitch is played.

Mode=3 means that the high pitch is played.

Mode is the variable name that the user can define, but 1, 2, and 3 respectively indicate low, medium, and high.

 

5. Experimental phenomena

After the program is successfully downloaded, after the micro:bit piano is powered on normally. 

After touching the H key, the third RGB light is lit red, and the pitch played by the piano is the highest; 

After touching the M key, the second RGB light is lit green, the the pitch played by the piano is middle; 

After touching the L key, the first RGB light lights is lit blue, and the pitch played by the piano is the lowest.

During the playing, touch each key, three RGB lights will display different colors of light, and the LED dot matrix will display different patterns according to the different heights. As shown below.

image.png image.png image.png

PS: When the battery is used for a long time, the piano board is not powered enough. At this time, the function will not be realized normally. You can replace the new battery or use USB data cable for power supply. The USB data cable power supply mode is shown in the figure below.

image.png 

 The code of the experiment:  5.Music_playing_spectrum.rar

Tutorial

    Buy Yahboom Micro:bit Expansion Board Piano Development Board

    0 comments

    Leave a comment

    Please note, comments must be approved before they are published