Untitled project
The micro:bit's LED display output
The micro:bit has lots of built-in images that you can show on the display.
The API documentation contains a full list of the built-in images.
You can scroll words and numbers on the micro:bit’s LED display:
You can add optional extra parameters to control the way scrolling works.
The delay
parameter controls the speed of scrolling. A delay less than 150ms will make scrolling faster than normal.
If the loop
parameter has a value of True
, the scrolling will loop continuously. The default value is False
which means there is no looping.
The wait
parameter controls whether the program waits for the scrolling to stop before carrying out the next instruction.
This code will keep scrolling the word 'score' faster than normal in a loop, and play music at the same time:
You can show words and numbers on the LED display one character at a time:
You can add optional delay
, loop
and wait
parameters.
The delay
parameter controls the speed at which multiple characters, digits or images are displayed. Any delay below 400ms will be faster than normal, anything above 400ms slower than normal.
If the loop
parameter is set to True
, the show
function will loop continuously. The default value is False
which means there is no looping.
The wait
parameter controls how long the program waits before the next instruction is executed.
This example will keep showing a countdown in a loop with 1 second between each number and will not wait before executing the next instruction:
You can make your own images. Each LED's brightness is represented as a number between 0 (off) and 9 (brightest):
This example shows a star that is bright in the middle and gets fainter towards the edges of the LED display.
Clear the display, turning all the LEDs off:
A pixel is an individual dot in an image. Each LED is a pixel in a micro:bit image. Each pixel has an x,y co-ordinate, starting at the top left with 0,0.
Use numbers 0 to 9 to select how bright you want each pixel to be, with 9 being the brightest. This will light the top left LED as bright as it can go:
This program will fill the LED display one pixel at a time:
Note that this uses a nested loop, a loop inside a loop.
Try out these projects, modify them and get inspired
For usage and examples, see Reference
Control the garbage collector
Log data to your micro:bit V2
Low-level utilities
Mathematical functions
Pins, images, sounds, temperature and volume
Measure the acceleration of the micro:bit and recognise gestures
Play sounds using the micro:bit (import audio
for V1 compatibility)
Use the built-in compass
Show text, images and animations on the 5×5 LED display
Communicate with devices using the I²C bus protocol
Respond to sound using the built-in microphone (V2 only)
Control the built-in speaker (V2 only)
Communicate with devices using the serial peripheral interface (SPI) bus
Communicate with a device using a serial interface
MicroPython internals
Create and play melodies
Individually addressable RGB and RGBW LED strips
Access the file system
Manage the power modes of the micro:bit (V2 only)
Communicate between micro:bits with the built-in radio
Generate random numbers
Make the micro:bit talk, sing and make other speech like sounds
Pack and unpack primitive data types
System specific functions
Measure time and add delays to programs
Project name
Untitled project
No rows logged
We use cookies, which are small files saved on your device when you visit a website. Some are essential for the site to work properly and are always enabled. Others help us store your preferences and understand how you use the site. To choose which cookies are enabled select “Manage cookies”.
We do not use third-party ads on microbit.org.