Step 1: Make it
What is it?
Make a music machine that plays different tunes at the push of a button.
These two videos show you what you'll make and how to code it:
How it works
- A jukebox is a machine that plays different songs when you put a coin in and choose which tune you want to hear by pressing buttons.
- This micro:bit jukebox uses headphones or speakers connected to make sound like we did in the Make some noise project.
- Connect micro:bit pin 0 to the tip of your headphone plug, and GND to the longer part of the headphone plug.
- When you make sound with the micro:bit, pin 0 becomes an output.
- This program plays different built-in tunes if you press input button A or button B.
What you need
- micro:bit (or MakeCode simulator)
- MakeCode or Python editor
- battery pack (optional)
- a pair of headphones, buzzer or amplified loudspeaker
- two crocodile clip leads
Step 2: Code it
Step 3: Improve it
- Change the tunes, for example try PRELUDE or ENTERTAINER. You can find a list of all the built-in tunes you can use in Python here.
- Show different pictures, letters, numbers or words depending on which tune you picked.
- Make it play a random tune if you shake it.