Case 4 - Play music

Part 1 Objective

After you write the program and upload it to mBot, your mBot can play music. You can adjust the notes and number of beats to make your mBot play any song.

6e37d543-af99-4cfa-9a64-124722186d04.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.

3b6ed37d-7c83-4e4c-8ff2-458feb7c6c21.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.)

ac1498be-f27a-4064-9b49-2ab5eb8610d4.gif

Part 3 Programming

After you press the on-board button, mBot plays the song of "Twinkle, Twinkle, Little Star".

2831c5c7-958c-4ff1-b3d5-284553476273.gif

Script image

ea4917f4-797b-49c3-bc5f-a124d0556bb8.png

Part 4 Project file

4.Play music.mblock

Part 5 Practice

  1. Change the notes.
  1. Change the number of beats.
  1. Increase/decrease the number of play note () for () beats blocks.

 

Was this article helpful?
2 out of 6 found this helpful

Comments

0 comments

Please sign in to leave a comment.