Making sounds with Micro:bit

Today we are going to show you to make sounds with Micro:bit. Did you know that there two versions of Micro:bit? They are the original Micro:bit and the V2. The original doesn't have a speaker sadly. But V2 does. If you can, get yourself a V2. Nowadays it is hard to buy the original Micro:bit anyway.

Let's write some code. First open a browser such as Chrome, go to this site and click "New Project":

https://makecode.microbit.org/#


I am going to call my project "Star Wars sounds" ... you will see why later. Now the project opens. All the sound related commands are in the category "Music". You can make your own songs with "Melody" and "Tones". Further down, there are some melodies ready to use. And at the very bottom there are some advanced functionalities that are only for Micro:bit V2. They are pretty cool!


I have created with my Dad two melodies from Stars Wars: one for the good guys and one for the bad guys. They have about 10 notes each. They will play when you press button A or B. Build the following code and tell me in the comments which one is the bad guys, A or B.

You can test it on the simulator by pressing button A or B

Notice how the simulator is showing you how to connect an external speaker if you need more volume. We had to do this for the Vortex project because we were in an outdoor area that was very noisy. If you want to learn about Vortex stay tuned

In the next post I will show you how to save your project and put it into the physical Micro:bit. Please go and buy one


Comments