Premade Images

Sometimes you might want the micro:bit module to simply show an image instead of scrolling text. We can do this with display.show method, using premade images from the Image object. For example: display.show(Image.DUCK).

Example script: Image

  • Enter, name, save, and flash the image script to your micro:bit.
#image

from microbit import *

display.show(Image.DUCK)

You should see a duck appear on your micro:bit module's LED matrix, like the picture shown above.

  • Replace DUCK with a different premade image from the lists below, and re-flash your program. 
  • Try some more. There are many to choose from!
Image.HEART
Image.HEART_SMALL
Image.HAPPY
Image.SMILE
Image.SAD
Image.CONFUSED
Image.ANGRY
Image.ASLEEP
Image.SURPRISED
Image.SILLY
Image.FABULOUS
Image.MEH
Image.YES
Image.NO
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.TRIANGLE
Image.TRIANGLE_LEFT
Image.CHESSBOARD
Image.DIAMOND
Image.DIAMOND_SMALL
Image.SQUARE
Image.SQUARE_SMALL
Image.RABBIT
Image.COW
Image.MUSIC_CROTCHET
Image.MUSIC_QUAVER
Image.MUSIC_QUAVERS
Image.PITCHFORK
Image.XMAS
Image.PACMAN
Image.TARGET
Image.TSHIRT
Image.ROLLERSKATE
Image.DUCK
Image.HOUSE
Image.TORTOISE
Image.BUTTERFLY
Image.STICKFIGURE
Image.GHOST
Image.SWORD
Image.GIRAFFE
Image.SKULL
Image.UMBRELLA
Image.SNAKE

Try This: Image Sequence

You have displayed a single image with a single line of code.  To display a series of images, place the sleep function on a line of code between them. The sleep function pauses the micro:bit module for a specified number of milliseconds, giving you time to see the image on the display. For example:

display.show(Image.HEART)
sleep(500)
display.show(Image.HEART_SMALL)
sleep(500)

...will show an image of a heart for half a second (500 milliseconds), then show an image of a small heart for another haf a second. Try it!

Example script: images

  • Enter, name, save, and flash the images script to your micro:bit.
#images

from microbit import *

display.show(Image.HEART)
sleep(500)
display.show(Image.HEART_SMALL)
sleep(500)

(500 ms) (500 ms)

Your Turn - Heartbeat

In the script images, the heart looks as if it beats once.

  • Can you modify your script to make the heart to beat 5 times?
  • After you get the heart to beat 5 times, make the heart beat faster.
  • Can you make the heart beat slower?