Here we show you how to create a custom image on the led matrix, we use the Mu editor
from microbit import *
im = Image('99999:90009:90009:90009:99999:')
display.show(im)
You can vary the brightness by changing the value of the digits from 0 – 9.
from microbit import *
im = Image('99999:96369:96369:96369:99999:')
display.show(im)
A simple animation example
from microbit import *
imgs = [
Image('90000:00000:00000:00000:00000:'),
Image('00000:09000:00000:00000:00000:'),
Image('00000:00000:00900:00000:00000:'),
Image('00000:00000:00000:00090:00000:'),
Image('00000:00000:00000:00000:00009:')
]
display.show(imgs, delay=1000,loop=True)
You can also set a pixel and move it around
from microbit import *
img = Image('00000:00000:00900:00000:00000:')
display.show(img)
sleep(1000)
while True:
img = img.shift_up(2)
display.show(img)
sleep(1000)
img = img.shift_right(2)
display.show(img)
sleep(1000)
img = img.shift_down(2)
display.show(img)
sleep(1000)
img = img.shift_left(2)
display.show(img)
sleep(1000)
shift_left(n)
Return a new image created by shifting the picture left by n columns.
shift_right(n)
Same as image.shift_left(-n).
shift_up(n)
Return a new image created by shifting the picture up by n rows.
shift_down(n)
Same as image.shift_up(-n).