micro:bit iPod Challenge

Home

Your Challenge

Can you turn your micro:bit into a iPod?

When your micro:bit is shaken it needs to be able to play one of 5 different songs. Use a random number generator to select a number between 0 and 4. Store this number in variable and display it on the screen. Then use a conditional to play the song using the start melody music block.

Hardware setup

In your kit of parts you will find a speaker, and a set of aligator clips. Using the black aligator clip connect the black wire on the speaker to the ground (GND) pin on the bottom of your micro:bit. Now using the red aligator clip connect the red wire on the speaker to the 0 pin on the bottom of your micro:bit.

Don’t forget that you should:

  1. Start by writing pseudocode to plan out what your program should do.
  2. Comment your code, so that others can read the code and understand what it does.
  3. Test your code first in the simulator and then on the physical device.
  4. Use/extend code that you have written in the past for ideas & inspiration.