5% OFF Over $19, Code: Elephant5; 10% OFF Over $59, Code: Elephant10

Microbit Python Tutorials 2 Display built-in image

Posted by SuFiona on

Course 2---Display built-in image

Learning goals:

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


from microbit import *


Below is a list of built-in images:

• Image.HEART
• Image.HAPPY
• Image.SMILE
• Image.SAD
• Image.ANGRY
• Image.ASLEEP
• Image.SILLY
• Image.MEH
• Image.YES
•Image.CLOCK12, Image.CLOCK11, Image.CLOCK10, Image.CLOCK9, Image.CLOCK8, Image.CLOCK7, Image.CLOCK6, Image.CLOCK5, Image.CLOCK4, Image.CLOCK3, Image.CLOCK2,Image.CLOCK1
•Image.ARROW_N, Image.ARROW_NE, Image.ARROW_E, Image.ARROW_SE, Image.ARROW_S, Image.ARROW_SW, Image.ARROW_W, Image.ARROW_NW
• Image.SQUARE
• Image.RABBIT
• Image.COW
• Image.XMAS
• Image.PACMAN
• Image.TARGET
• Image.TSHIRT
• Image.DUCK
• Image.HOUSE
• Image.GHOST
• Image.SWORD
• Image.SKULL
• Image.SNAKE
• Image.ALL_ARROWS   

Programming and downloading

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

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


Figure 2-1

2.As shown in Figure 2-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 2-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 2-3.


Figure 2-3

4.After the download is successful, you can see that a heart on the micro:bit dot matrix .as shown in Figure 2-4.


Figure 2-4.

The code of the experiment:  2.Display built-in image.rar

Last Microbit Tutorial >> Microbit Python Tutorials 1: Hello,World!
Next Microbit Tutorial >> Microbit Python Tutorials 3: Display custom image


Leave a comment

Please note, comments must be approved before they are published