19. Case 18: Music Box

19.1. Introduction

This is a music box. We can control the buzzer on the micro:bit to emit different melody by pressing the button A on the micro:bit.

19.2. Quick to Start


Nezha expansion board × 1

micro:bit × 1

Connection Diagram

Insert the micro:bit to Nezha expansion board.


19.3. MakeCode Programming

Programme as the picture shows:



Press button A to switch the music.