Microbit Python Tutorials 3: Display custom image

Posted by SuFiona on

Course3-Display custom image

Learning goals:

This lesson learns to display custom image on a micro:bit dot matrix by Python programming. For example: boat. 


from microbit import *

boat = Image("49494:"






from microbit import *

boat = Image("49494:49494:49494:99999:49994")


1 - The capital letter / lowercase letters must be distinguished

2 - Correct spelling!

3 - Keywords such as # need a space between the content.

4 - The program ends with a blank program.

5 - The block body (such as the body of the while is marked by indentation), compared to the C language, Python completely eliminates the braces (along with the semicolon of the suffix), and uses the indentation structure to represent the relationship. You can only use the Tab key (tabulation key) for indentation.  

Micro:bit possess a dot matrix of 5*5 LEDs, and each LED brightness on the dot matrix can be set to a value from 0 to 9. If the brightness of an LED is set to 0, then it goes out. If its brightness is set to 9, it is at the brightest level. Using this feature, we can display a custom image on the micro:bit dot matrix. The code implementation of our class shows a boat on the micro:bit dot matrix. The background brightness value is 5, the hull part. The brightness should be brighter, the brightness value is 9, you can set other brightness values to display different patterns. 

Programming and downloading

1.You should open the Mu software, and enter the code in the edit window, ,as shown in Figure 3-1.

Note! All English and symbols should be entered in English, and the last line must be a space.blob.png 

Figure 3-1

2.As shown in Figure 3-2, you need to click the Check button to check if our code has an error. If a line appears with a cursor or an underscore, the program indicating this line is wrong.


Figure 3-2

3.You need to connect the micro data cable to micro:bit and the computer, then click the Flash button to download the program to micro:bit as shown in Figure 3-3.



4.After the download is successful, you can see that a boat on the micro:bit dot matrix . The brightness of the background is weaker than the brightness of the hull, as shown in Figure 3-4.


Figure 3-4

The code of the experiment: 3.Display custom image.rar 

Last Microbit Tutorial >> Microbit Python Tutorials 2 Display built-in image
Next Microbit Tutorial >> Microbit Python Tutorials 4: Display custom animation



Leave a comment

Please note, comments must be approved before they are published