Case 3 - Press the on-board button to play notes

Part 1 Objective

After you write the program and upload it to mBot, your mBot can identify the button you press, and tell whether the button is pressed and play the note once you press the on-board black button.

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

Part 2 Preparation

  • mBot x 1
  • USB cable (Type-B) x 1
  • Computer with network access x 1
  1. Connect mBot to the computer by using the cable.

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

  1. Open mBlock 5 (PC client or web version), click +add in the lower left Devices area, select mBot from the Device Library, click Connect, and select the Upload mode. (Live mode: you can click on the blocks to see the real-time running effect, but you need to keep the cable connected to the computer. Upload mode: you can upload a program to mBot, and you can unplug the cable to run the program.)

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

Part 3 Programming

After you upload the program to mBot, your mBot plays the note when you press the on-board black button.

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

Script image

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

Part 5 Practice

  1. Change the note.
  1. Change the number of beats.

 

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

Comments

0 comments

Please sign in to leave a comment.