Skip to content
13micro:bit ยท MakeCode 25 minutesV2 only

V2 music

Play a short melody on the built-in speaker; stop it with B.

V2 music project
Illustration of the finished idea. Build from the diagram and connection table, not the photo.

Lesson goal: On a micro:bit V2, enable the built-in speaker, play a melody on A, and stop sounds on B.

Open MakeCode

Section 1

Understand

  • built-in speaker (V2)
  • tones and frequency
  • stop flag
  • concurrent events
  • 1V2 boards have a built-in speaker. V1 boards should skip this.
  • 2A plays a short tune, B stops all sounds.
  • 3Never drive the kit buzzer straight from a pin.

Safety first

  • Keep volume reasonable; do not hold the speaker against an ear.
  • Remove external circuits from P0 before running.