News & Blog

By Julho 04, 2019 0 Comment


Get to know the display

The micro:bit has a display made up of a 5x5 grid of LED lights. You can show numbers and words on it and the micro:bit also has some built-in pictures you can use.

a micro:bit with a pattern on the LEDs

You can program the BBC micro:bit using our Python editor. Make sure the editor contains the following code:

from microbit import *

while True:
    display.scroll('Hello, World!')

Change the ‘Hello World’ message and change the heart image, then flash it to your micro:bit. Change HEART to HAPPYSADCONFUSEDPACMANGHOST or DUCK.

You can find a full list of images in our Python guide. They were designed by Abbie when she was 11 years old!

You can also make your own pictures. Each number represents one of the LED lights. The bigger the number, the brighter the LED will be. 0 is off, 9 is the brightest. This program will show a picture. Flash it to your micro:bit to see what it is - or can you work it out from looking at the code?

from microbit import *

mystery = Image('00300:'

Draw with pixels

Python lets you light up individual ‘pixels’ on the LED display. The LEDs are numbered using x, y co-ordinates. The top left corner is 0, 0 and the bottom right corner is 4, 4:

0, 0 1, 0 2, 0 3, 0 4, 0

0, 1 1, 1 2, 1 3, 1 4, 1

0, 2 1, 2 2, 2 3, 2 4, 2

0, 3 1, 3 2, 3 3, 3 4, 3

0, 4 1, 4 2, 4 3, 4 4, 4

You also need to tell the micro:bit how bright you want to make each LED light using numbers from 0 to 9. This program will put a bright dot (9) in each corner, wait 3 seconds then clear the display:

from microbit import *
import random



Modify this program to draw an ‘X’ on the display just using display.set_pixel() commands.

a micro:bit with a pattern on the LEDs

O tutorial é cedido pelo site da micro:bit onde pode tirar mais ideias para os seus projetos.

Pode escolher diretamente na nossa loja Boxelectronica os vários kits que temos disponíveis. 

Leave your thought