Skip to content

Display Text on the LED Matrix

Level Beginner
Board V1 & V2
Parts micro:bit

What you'll build

Your first micro:bit program: scroll a greeting across the 5×5 LED matrix, then flash a heart — forever.

Code

1 display string.py
'''
Example: Print strings and shapes on LED matrix in micro:bit
By: Meqdad Darwish
'''
from microbit import *

while True:
    display.scroll('Hello Meqdad!')
    display.show(Image.HEART)
    sleep(2000)  # 2000 = 2 sec.

How it works

  • display.scroll() slides a string across the LEDs one column at a time and returns when the text has passed.
  • display.show(Image.HEART) draws one of the built-in images instantly.
  • sleep(2000) pauses for 2000 milliseconds (2 seconds) before the loop starts again.

Try this next

  • Change the message to your own name.
  • Pass delay=60 to display.scroll() to make the text scroll faster.
  • Show a different built-in image — see Display Built-in Images.