Science Oxford Logo

Creature Circuits - Making Music

Making the circuit

To add sounds to your creature, you will need some additional materials:

Connect the two legs of your buzzer to pin0 and GND on your micro:bit.

If you have an LED connected to pin0, you will need to move it to a different pin (keep it attached to GND though, both things can share this) - remember to change your code to match the new LED pin.

Try out the code below using the buzzer and crocodile clips before adding some dough.

makecode

Writing the code

Try out the code below, then experiment - where do you want to put it in your program?

Scroll down for the Python version!

makecode

If you are using Python, try this code:

from microbit import *
import music

music.play(music.ODE)

What other tunes can you get the micro:bit to play?

You can also use Text-to-Speech in Python! Try this:

from microbit import *
import speech

speech.say("hello humans")

Unfortunately, speech and music cannot work at the same time.

Change the code to say your name, or a funny phrase!


Final steps

Test out some of the music code and see what you can create.

Once you are happy with the code, connect your micro:bit back to your dough creature.