BBC micro:bit board x 1
OSOYOO Plug&Play( PnP ) board for micro:bit x 1
OSOYOO Passive Buzzer module x 1
OSOYOO 3-pin PnP cable x 1

Connect Passive buzzer module with OSOYOO PnP board for micro:bit P0 with OSOYOO 3-pin PnP cable as below;

Step 0: Go to url: https://makecode.microbit.org , click New Project , right click on start block and delete it.

Step 1. In the Toolbox, click on the Basic category and then click the show icon block over, and place it inside the on start block .  Click the  music note patterns from the block choices as following:

Step 2.Click on the Music category. Then  drag the Play tone for beat block over, and drop it down 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.  Following picture shows the notes name in the 21-key piano keyboard   and their frequencies in Hertz .
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 save it to your MICROBIT disk Driver as following picture.

Below are the full Graphic programming  code blocks to play the music of  Ode to Joy




Learn More about parts

No. Picture Product Name Link
1 BBC micro:bit micro Mainboard https://osoyoo.store/products/bbc-micro-bit-micro-controller-with-motion-detection-compass-led-display-and-bluetooth?variant=31021023002735
2 OSOYOO Expansion board for Micro:bit https://osoyoo.store/products/pnp-board-for-micro-bit-stem-kitmodel-2018005900?variant=31698997444719
3 Green LED Module https://osoyoo.store/products/green-led-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31957968158831
4 Yellow LED Module https://osoyoo.store/products/yellow-led-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500
5 Red LED Module https://osoyoo.store/products/red-led-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31957964882031
6 White LED Module https://osoyoo.store/products/white-led-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31816681128047
7 Humi & Temp Module https://osoyoo.store/products/humi-temp-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31957977563247
8 Passive buzzer Module https://osoyoo.store/products/passive-buzzer-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500
9 Flame sensor Module https://osoyoo.store/products/flame-sensor-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500
10 Red Button Module https://osoyoo.store/products/red-button-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31958006693999
11 Yellow Button Module https://osoyoo.store/products/yellow-button-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31958014328943
12 Photoresitor Module https://osoyoo.store/products/photoresitor-module-for-arduino-microbit-osoyoo-stem-kitmodel-2019011500?variant=31958061154415
13 RGB Module https://osoyoo.store/products/rgb-module-for-osoyoo-stem-kit-for-micro-bit-arduino-raspberry-pi-model-2019011500?variant=31958069739631
14 IR Receiver Module https://osoyoo.store/products/ir-receiver-module-for-arduino-raspberry-pi-micro-bit-stem-model-2019011500?variant=31958077309039
15 Infrared Remote Controller https://osoyoo.store/products/infrared-remote-controller-for-arduino-raspberry-pi-microbit-stemmodel-2019011500?variant=31958087532655
16 Microphone Module https://osoyoo.store/products/microphone-module-for-arduino-raspberry-pi-micro-bit-stem-model-2019011500?variant=31958089597039
17 Potentiometer Module https://osoyoo.store/products/potentiometer-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31817102852207
18 Fan Motor module https://osoyoo.store/products/fan-motor-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31957989359727
19 Micro Servo motor https://osoyoo.store/products/micro-servo-sg90-blue-for-arduino-v2-0-robot-carmodel-lacc200610
20 Ultrasonic detector module https://osoyoo.store/products/ultrasonic-detector-module-for-arduino-raspberry-pi-micro-bit-stemmodel-2019011500?variant=31958286729327
21 1602 I2C LED Screen https://osoyoo.store/products/white-led-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011501?variant=31817047048303
22 1 Channel Relay Module https://osoyoo.store/products/1-channel-relay-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31957950562415