Hack Your Headphones - Micro:Bit




Introduction: Hack Your Headphones - Micro:Bit

Use your Micro:Bit to play music through your headphones!


- Yourself

- Micro:Bit

- Battery Pack (Optional)

- Mirco USB

- Alligator Clips x2

- Headphones

- Computer

Step 1: Inventory

Make sure you have all of your supplies!

Step 2: Ground

Use one of your alligator clips to connect the ground pin on the Micro:Bit to the ground pin on the headphones.

Step 3: Pin 0

Use your other alligator clip to connect the pin 0 on the Micro:Bit to both the left and right pins on the headphones.

Step 4: Connect

Use the micro USB to connect your Micro:bit to your computer.

Step 5: Let's Code!

Go to the Micro:bit compiler website.


Step 6: Forever Loop

Insert a forever loop. The code that goes in this loop will execute forever on repeat as long as the Micro:Bit is on.

Step 7: If Statement

Insert an if statement inside of the forever loop. The code that goes inside an if statement only executes if the condition is met.

Example: If it is rainy, then I will use an umbrella.

In the example above, I only use an umbrella if the condition "it is rainy" has been met.

Step 8: Condition

Next we will add the condition: "button A is pressed." I want the music to play whenever I press the button, so this is the condition I set.

Step 9: Music

Now we will add the code to make music play. The music will play once our condition of pressing the button is met.

I personally like the Nyan Cat song, so I am going to change the melody to nyan.

Step 10: Download

Click the download button. This downloads the program to your computer as a .hex file.

Step 11: Find File

Click the arrow next your downloaded file, then click show in finder. This will show where your program saved on your computer.

Step 12: Flash

Next you will flash the file to your Micro:Bit. Click and drag the file to your Micro:Bit in the navigation bar. A loading bar will pop up while it is flashing to the Micro:Bit. Wait until it finishes.

Step 13: Test

Press the A button on your Micro:Bit to play your music!

If the music does not play, go ahead and review the previous steps to make sure you didn't miss anything.

Step 14: Unplug & Play!

Unplug your Micro:Bit from the computer and plug in your battery pack. Congratulations! You just made your own mp3 player!!!

Go ahead and try the project again! Play around a bit!

What happens if you change the wires around?

What happens if you change the button code?

What happens if you change the music code?

Can you make a music note show on the screen?

Step 15: Here Are Video Instructions If You Prefer That! :)

Be the First to Share


    • Anything Goes Contest

      Anything Goes Contest
    • Baking Contest

      Baking Contest
    • Cold Challenge

      Cold Challenge



    Tip 2 years ago

    Use board headphone jack because cause short circuit headphone.
    it was good


    Question 2 years ago on Introduction

    hey, would you help me where can I learn the tutorials of microbit?