Micro:bit piano board Basic Course 3.1 color_RGB
In this lesson we mainly learn how to use the music touch return, music button and RGB blocks of Yahboom piano expansion package.
By programming, we will control the RGB lights on the piano board displays different effects.
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.
How to create a new variable：
4.Combine building block
The summary program is shown below:
5. Experimental phenomena
After the program is successfully downloaded, micro:bit dot matrix displays a love pattern, as shown in Figure 1.
When we touch the L button on the piano expansion board, the three RGB functions will realize the marquee, as shown in Figure 2 below;
When we touch the M button on the piano expansion board, the three RGB lights will realize the breathing light. The function is shown in Figure 3 below;
When we touch the H button on the piano expansion board, the three RGB lights will realize the function of the water light, as shown in Figure 4 below.
Figure 1 Figure 2
Figure 3 Figure 4
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.
The code of the experiment: 1.color_RGB.rar
- Micro:bit piano board Tutorial
- Last Tutorial>> Micro:bit piano board Basic Course 2.5 Piano_playing
- Next Tutorial>> Micro:bit piano board Extended_course 3.2 Light_music