Anish Ansari
Published © LGPL

Piezo Buzzer with BBC micro:bit

By the end of this tutorial, you will be able to connect and play sound with micro:bit on the piezo buzzer.

BeginnerFull instructions provided30 minutes4,246

Things used in this project

Hardware components

BBC micro:bit board
BBC micro:bit board
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
AA Batteries
AA Batteries
×2
Alligator Clips
Alligator Clips
×2
Buzzer
Buzzer
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Story

Read more

Schematics

Circuit

Code

Code for Buzzer

JavaScript
input.onButtonPressed(Button.A, () => {
    music.beginMelody(music.builtInMelody(Melodies.Dadadadum), MelodyOptions.Once)
    basic.showIcon(IconNames.Heart)
    basic.pause(100)
    music.beginMelody(music.builtInMelody(Melodies.JumpDown), MelodyOptions.Once)
})

Credits

Anish Ansari

Anish Ansari

11 projects • 29 followers
Azure and IoT

Comments

Add projectSign up / LoginAbout BBC micro:bit