Micro:bit piano board Basic Course 2.3 Switch_color_of_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 make the micro:bit dot matrix displays different patterns by touching the five black keys and three note button on the piano expansion board.
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, a smiley pattern will be displayed on the micro:bit dot matrix. When we touch the CD button on the piano expansion board (the 1st black key from the left), DE button, FG button, GA button, AB button (the 5th black keyboard from the left), L button, M button, H button. When the button is pressed, the RGB lights on the piano expansion board will light different colors.
（If you want to use other keys to control the RGB light to display other colors, you can modify the program yourself.）
The code of the experiment: 3.Switch_color_of_RGB.rar
- Micro:bit piano board Tutorial
- Last Tutorial>> Micro:bit piano board Basic Course 2.2 Dot_matrix_display
- Next Tutorial>> Micro:bit piano board Basic Course 2.4 Control_ brightness_of_RGB