Learn programming using Micro Bit and Fedora

The BBC micro:bit (or Micro Bit) is an ARM-based embedded system designed by the BBC for use in computer education in the UK. It will be given to every 11 year old student in UK. The device is based on ARM Cortex-M0 processor, and has an accelerometer and magnetometer sensors. In this article, you’ll learn how to get started with programming using a Micro Bit with Fedora.

Programming with Micro Bit: Set up with an LED display

A Micro Bit device with a display array of 25 LEDs.

Getting Mu on your Micro Bit

From Fedora 24 (and also on Fedora 23), you can install the official Python IDE, Mu. With Mu, you can learn Python and programming in general using a Micro Bit. Install it like any other official package in Fedora:

$ sudo dnf install -y mu

After installing the package, add your user account to the dialout group:

$ sudo usermod -a -G dialout username

Log out and log back in again for the change to take effect. Then you can start the IDE as a normal application.

Programming with Micro Bit: Opening Mu, a Python IDE

This is how Mu looks when you first open it.

Writing your first program in Mu

To write your first program, you need to provide input to the Micro Bit. One way to do this is with the Read Eval Print Loop, or Repl. To access the Repl on the device, click the Repl button. You can now start writing standard Python 3 code into the Repl.

Programming with Micro Bit: Getting started with Mu

Running the program on the Micro Bit

Now you can use the editor to write a full Python program, and save it on the local computer. When it’s ready, you can upload it to the device by clicking the Flush button. The yellow LED on the Micro Bit blinks while the code is flushed into the device.

Programming with Micro Bit: Writing beginner code with Mu

Programming with Micro Bit: Running your code in the Micro Bit

The full source for the example in this article can be found below. It is written by Nicholas H.Tollervey, who also oversaw the effort of running MicroPython on the BBC Micro Bit. He is also the upstream author of Mu.

# Make the display sparkle. Click button A to show an image for
# a moment before the sparkles start again. Click button B to
# scroll a friendly message before the sparkles return.
# By Nicholas H.Tollervey and released to the Public Domain.
# How would you improve this code?
from microbit import *
import random

# A full list of images can be found here: http://bit.ly/1WY221q
images = [Image.HAPPY, Image.SAD, Image.GHOST, Image.SKULL,

while True:
 x = random.randint(0, 4)
 y = random.randint(0, 4)
 brightness = random.randint(0, 9)
 display.set_pixel(x, y, brightness)
 if button_a.was_pressed():
 if button_b.was_pressed():
 display.scroll("Hello, World!", delay=100)
For Developers Using Hardware Using Software


  1. Interesting article…..

  2. cyber-woozle

    this is great, are the led’s used to give some output on the device?

  3. lol

    Nah the LEDs are used to rectify AC when you power it directly from the wall. Someone donated a buttload of LEDs so it was more economical to use them than regular diodes.

  4. You have me peeked already. Thank you!

  5. Miroslav Suchy

    Instead of


    you should execute


    . Useradd create new user, while usermod modify existing user.

  6. Lawrence Aberba

    This board will really be great if I could lay my hands on some for my community kids. Great for UK kids.

  7. Vlad

    is it “flush” or “flash”? I see a button in mu that says flash(?)

  8. Karl Krogmann

    I love it! Wish I had one of these as a kid.

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions

%d bloggers like this: