Musical quiz buzzer for BBC micro:bit: Python for beginners

Try it with code
Try the code

Below is a copy of the python code you’ll need for your musical quiz buzzer. You can run it in the micro:bit simulator by clicking on the run button in the bottom left corner.

If you want to test it on an actual micro:bit, there’ll be a link at the top of the screen to download the hex file that you can copy across to your micro:bit. To hear the sound you’ll need an old speaker. Salvage one from some broken headphones or an old radio or anything you’ve go lying around the house / school. Probably best to ask whoever it belongs to before you break it open though!

Connect it to your micro:bit as shown below.

Connect micro:bit to a speaker
Connect micro:bit to a speaker

It doesn’t matter which way round the wires go as long as one connects to pin 0 and one to GND. Crocodile clips are best for this but you can test it by holding the wires to the right pins – you wont get an electric shock. OK, technically, you will, but it’ll be such a low current that you wont feel a thing. Honest.


The micro:bit simulator will play music and sound if you use it in Safari, Chrome, Edge, Firefox or mobile browsers but I haven’t got it working yet in Internet Explorer. If it’s possible, I’d recommend trying a different (better) browser than Internet Explorer.

One thought on “Musical quiz buzzer for BBC micro:bit: Python for beginners

Leave a Reply

Your e-mail address will not be published. Required fields are marked *