Here's how to display images and image animations on the LEDs.
from microbit import *
# images
display.show(Image.HAPPY)
sleep(2000)
display.show(Image.HEART)
sleep(2000)
display.show(Image.PACMAN)
sleep(2000)
display.show(Image.SNAKE)
sleep(2000)
# animations
display.show(Image.ALL_CLOCKS)
sleep(2000)
display.show(Image.ALL_ARROWS)
After you've downloaded and run this program on the micro:bit try out these other image names: SMILE, SAD, CONFUSED, ANGRY, ASLEEP, SURPRISED, SILLY, FABULOUS, MEH, YES, NO, TRIANGLE, TRIANGLE_LEFT, CHESSBOARD, DIAMOND, SQUARE, RABBIT, COW, MUSIC_CROTCHET, MUSIC_QUAVER, MUSIC_QUAVERS, PITCHFORK, XMAS, TARGET, TSHIRT, ROLLERSKATE, DUCK, HOUSE, TORTOISE, BUTTERFLY, STICKFIGURE, GHOST, SWORD, GIRAFFE, SKULL, UMBRELLA, SNAKE.
Return to the BBC micro:bit MicroPython Coding Tutorials page.
No comments:
Post a Comment