Case 3 - Press to play

Part 1 Objective

User writes the program and uploads the program to mBot, which will activate the key recognition function, so that it can determine whether to press the key and play the note after pressing the key.

b75a01d4-9e13-48bf-8641-b3ec124f456e.gif

 

Part 2 Preparation

  • mBot x1
  • USB cable x1
  • Computer with network access
  1. Use a data cable to connect the mBot to the computer

65edafc7-c5f2-4587-bc40-81b46784a5a3.gif

  1. 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".

6e8ccbd4-67ab-4939-b9ad-72bbcdfcd9e2.gif

 

Part 3 Programming

After the user uploads the program to the mBot, the mBot will play the corresponding musical note whenever the User presses the black button on the board.

da9419e6-3aad-4364-bdb6-831de36d895e.gif

Source program diagram

e9d2cc18-5464-4795-ac69-8bc2c187f9a2.png

 

Part 4 Procedure source code

Lesson 3_Playing notes by key.mblock

 

Part 5 Practice

  1. Change the type of musical note
  1. Change the musical meter

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.