Got yourself a Microbit? Awesome! They’re a great way to learn Python!

Pick an editor

Know your Microbit


Lesson 1: Your first Microbit program

Watch the video and you will:

Lesson 2: Conditionals

Watch the video and you will:

Lesson 3: Numeric variables and operators

Watch the video and you will:

Lesson 4: Compound conditionals

Watch the video and you will:

Lesson 5: Lists

Watch the video and you will:

Lesson 6: For in range()

Watch the video and you will:

Lesson 7: More on conditionals

Watch the video and you will:

Lesson 8: Bluetooth networking

Watch the video and you will:

Lesson 9: Neopixels

Watch the video and you will:

Lesson 10: Writing functions and using servos

from microbit import *

def servo(pin, degrees=0):
    microseconds = 600 + 1800 * degrees // 180
    signal = round(microseconds * 1024 * 50 // 1000000)
    pin.write_analog(signal)    # send signal to pin
    sleep(500)                  # allow half second for rotation
    pin.write_digital(0)        # turn off pin

servo(pin0, 0)
while True:
    if button_a.was_pressed():
        servo(pin0, 180)        # rotate servo to 180 degree position
    if button_b.was_pressed():
        servo(pin0, 0)          # rotate servo to 0 degree position

Lesson 11: Ultrasonic sensors

# Ultrasonic
# http://www.teachwithict.com/hcsr045v.html


Display & buttons

  1. Make your name scroll across the LED display
  2. Display to ask “How do you feel?”. Press button A to show happy emoji, button B to show sad emoji.
  3. Create your own image using the Image() function
  4. Make your image from the previous fade in after pressing button A, and fade out with button B.
  5. Make a ball on the display that bounces when you press button A


  1. Inspired by this video can you use some NeoPixels to create an LED analog clock?
  2. What about creating a binary clock with NeoPixels?

tip: the following are some useful MicroPython time commands…

year, month, day, hour, minute, second, ms, dayinyear = utime.localtime()
seconds_since_epoch = utime.time()
milliseconds_powered_up = running_time()


  1. Display the letters “L” or “R” on the display based on which side of the microbit is tilted higher.
  2. Make the LEDs light up to indicate the magnitude of acceleration. Moving slow, just a couple of LEDs; moving fast, a lot of LEDs.


  1. Have the microbit display “N”, “S”, “E”, “W” to indicate which way it is facing.
  2. Have the microbit turn into a compass where the LED display turns on the LED closest to North.


  1. Print the temperature on the display.
  2. Use the LEDs to visually display how hot it is… different emoji’s for different temperature.
  3. Calculate how much the temperature changes over time. Have the microbit tell you how much the temperature changed each time you press button A, compared to the previous time you pressed button A.


  1. Make a song!
  2. Turn the microbit into a musical instrument. Change the pitch using the accelerometer.

Bluetooth radio

  1. Send morse code from one microbit, to display on the LEDs of another microbit.
  2. Can you make some type of two player game involving the radio, the buttons and the display?



That’s ok. To err is human. One powerful method of learning is by fixing our mistakes! Keep at it!

Reference documents

The following links take you to the various sections of the official Microbit Python tutorials: