Use this page to learn how to wire up, and program, your new components.

Once you know how they work, try adding them into another project! For example, expand our micro:bit name badge project.

Click on a picture to jump to the component you want to try first!

LED - wiring and example code

LED wiring instructions LED wiring photo

Take a crocodile clip, and connect one end of it to pin 0 on your micro:bit.

Connect the other end of your crocodile clip to the positive lead of your LED (the longer one).

Connect a second crocodile clip between the GND pin on your micro:bit, and the negative lead of your LED (the shorter one).

Now try the below code... what happens to your LED?

from microbit import *

while True:
    pin0.write_digital(1)
    sleep(500)
    pin0.write_digital(0)
    sleep(500)
makecode

RGB LED - wiring and example code

RGB LED wiring instructions

Take a crocodile clip, and connect one end of it to pin 0 on your micro:bit.

Connect the other end of your crocodile clip to one of the positive leads of your LED (the shorter ones).

Connect a second crocodile clip between the GND pin on your micro:bit, and the negative lead of your LED (the longest one).

Now try the below code... what happens to your LED?

from microbit import *

while True:
    pin0.write_analog(1023)
    sleep(500)
    pin0.write_analog(0)
    sleep(500)
makecode

Now remove the crocodile clip from the positive lead you first chose, and connect it to a different positive lead instead.

The ground lead must always stay connected.

One of the leads is red, one green, and one blue!

Button - wiring and example code

Button wiring instructions

Take a crocodile clip, and connect one end of it to pin 0 on your micro:bit.

Connect the other end of your crocodile clip to one of the leads of your button.

Connect a second crocodile clip between the GND pin on your micro:bit, and the other lead of your button.

Now try the below code... what happens when you press the new button?

from microbit import *

while True:
    button = pin0.read_digital()
    if button == 1:
        display.show(Image.DUCK)
    else:
        display.clear()
makecode

Speaker - wiring and example code

Speaker wiring instructions Speaker wiring photo

Take a crocodile clip, and connect one end of it to pin 0 on your micro:bit.

Connect the other end of your crocodile clip to one of the leads of your speaker.

Connect a second crocodile clip between the GND pin on your micro:bit, and the other lead of your speaker.

Now try the below code... what happens?

from microbit import *
import music

music.play(music.ODE)
makecode

If you are using Python, try the below code... what happens this time?

from microbit import *
import speech

speech.say("hello humans")

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