Connect Passive buzzer module with OSOYOO expansion board for Micro:bit P0 with 3pin wire as below;
Step 1. In the Toolbox, click on the Basic category and then click the show icon button, and then click on the Musical Note icon.
Step 2.Click on the Music category. Then click and drag the Play tone for beat block over, and place it inside the on Start block .
Step 3. The Play tone (Hz) for beat block allows you to play a tone of specific frequency. The default frequency of the Play tone (Hz) for beat block is set to 262 Hz (tone), which is Middle C (note). When you click on the parameter box of the play tone block, a 21-key visual piano keyboard will display and allows you to choose a note.
When you choose a note from the visual piano keyboard, the frequency of the note will display in the parameter box of the ring tone (Hz) block. If you know the frequency of the note you want to play, just type the frequency in the parameter box without choosing it from the visual piano keyboard. The precision of the frequency of a note is ± 1 Hz. As an example, for Middle C, the valid frequencies are 261, 262, and 263 Hz 。In the below picture lists names of all the notes available to choose and their frequencies in Hertz in the 21-key piano keyboard.
This is Piano score for Ode to Joy :
Step 4.According the Piano score for Ode to Joy ,Choose the note click on the parameter box of the Play tone (Hz) for beat block ,then put it below the last Play tone (Hz) for beat block .Every note in one Play tone (Hz) for beat block.Click the button A ,you can check if the music note you are doing well.
Step 5. Download this “.hex” file and send it to your MICROBIT disk.
Below is the full code we have done for you as reference:
DownLoad Url osoyoo.com