micro:bit Piezo Buzzer
A type of buzzer – it has to be driven by a pulsed output. It’s tuned for around 2kHz when it will be at its loudest but will produce a tone across a wide range of frequencies.
In the Block Editor, the black lead goes on to GND and the blue lead goes on to the Pin 0.
In TouchDevelop you can choose which pin you want to use, so the black lead goes on to GND and the blue lead goes on to the Pin 0, 1 or 2 that is being used.
This would output a 440Hz tone on Pin 0 for 1000mS:
The script is available here.