Age Range: First time using external devices for the micro:bit

The MakeCode editor has a dedicated tab to making music and sounds with the micro:bit. Using the external speaker, students will learn the basics of how the music tab works and how sounds can be produced from the micro:bit.


  • Gain a basic understanding of the music tab in the MakeCode editor.
  • Create music using the micro:bit and external speaker.

Download the Code

MakeCode Editor

Click the button below to download the MakeCode editor code for this lesson. The hex file is contained in a zip folder.

Kindly refer to our download the code page for instructions on how to upload your code onto the micro:bit. Please use instructions set A.

This code can also be uploaded into the MakeCode editor.

Kit Required


Mini Innovation Board


- MicroUSB Cable
- 1 x Connector Cable


  1. Connect the micro:bit to the Mini Innovation board via the edge connector.
  2. Use the connector cable to connect the speaker to the ADC1 connector on the Mini Innovation board.
  3. Connect the micro:bit to a computer via the microUSB cable.
  4. Go to the MakeCode website on your computer and open a new project.

Time to Code

As you go through these steps please note that there are images of the completed code to the right.

  1. Firstly select the ‘on button pressed’ block from the ‘inputs’ tab and select button A from the drop down. Students should be familiar with this block by now.
  2. Next, go into the ‘music’ tab and select the ‘play tone’ block. Insert this into the ‘on button pressed’ input. By default, middle C is the tone selected but feel free to change this. Leave the default, 1 beat.
  3. Then, select another ‘on button pressed’ block from the ‘inputs’ tab. This time choose button B from the drop down.
  4. Open the ‘music’ tab again and select the ‘start melody’ block. Insert this into the ‘on button pressed B’ input. Choose any of the melody options from the drop down but leave the repeat to once.
  5. The code is now finished! Download the code and upload it onto the micro:bit. The instructions for this can be found on the download the code pagePlease use instructions set B.

What Will Happen

When button A is pressed a tone will play from the speaker for 1 beat. When button B is pressed a melody will play once.

Taking it Further

  • Explore the ‘music’ tab further and experiment with other blocks available.
  • Use the skills learned to help complete the more advanced control lessons.

Keep in Touch

We would love to keep in touch with you and as a result aid you along your digital making journey.

Becoming a digital maker subscriber means you will receive exclusive offers and we will keep you up to date with new resources and kits, as well as upcoming events and workshops.

Let us know how your digital education journey is progressing. Send us pictures and videos of your awesome creations and use the hashtag below.