Part 1 Objective
User writes the program and uploads the program to mBot. User will give mBot the ability to play music, and by adjusting the corresponding musical notes and beats, any song can be played.
Part 2 Preparation
-
mBot x1
-
USB cable x1
-
Computer with network access
-
Use a data cable to connect the mBot to the computer
-
Open MBlock5 (PC, Web, APP), click "Add" in the lower left device area, select mBot in the device library, and click “Connect”.(Live mode: you can click the building block to observe the real-time running effect, but you need to keep the data cable connected to the computer; Upload mode: You can upload the program to mBot, at which time you can unplug the data cable to run the program. ), this course needs to switch to "Upload mode".
Part 3 Programming
When the user presses the on-board button, the song from "Brother John" is played.
Source program diagram
Part 4 Procedure source code
Part 5 Practice
-
Change the type of musical note
-
Change the musical meter
-
Increase/decrease the number of Play Notes blocks
Comments
Please sign in to leave a comment.