micro:bit Display & Buttons Cheatsheet
micro:bit Display & Buttons Cheatsheet
display.show, scroll, set_pixel, images, and button methods.
Text & Numbers
| display.scroll("text") | Scroll a string across the display left to right |
| display.scroll("text", delay=50) | Scroll with custom speed (ms per frame, lower = faster) |
| display.show("A") | Show a single character or built-in image |
| display.clear() | Turn off all 25 LEDs |
Images
| Image.HEART / HAPPY / SAD | Common built-in images |
| Image.YES / NO / ARROW_N | More built-ins ߀” YES=tick, NO=cross, ARROW_N=up arrow |
| Image("05050:05050:05050:99999:09990") | Custom 5G—5 image ߀” digits 0߀“9 = LED brightness |
| display.show(Image.ALL_CLOCKS, loop=True) | Animate a list of images in a loop |
Pixel Control
| display.set_pixel(x, y, brightness) | Set one LED (0,0=top-left), brightness 0߀“9 |
| display.get_pixel(x, y) | Get current brightness of one LED |
| x: 0߀“4 (left to right) | Column index |
| y: 0߀“4 (top to bottom) | Row index |
Buttons
| button_a.is_pressed() | True while button A is held down |
| button_a.was_pressed() | True if pressed since last check ߀” clears the flag |
| button_a.get_presses() | Number of presses since last call ߀” resets the count |
| pin_logo.is_touched() | True when the gold logo is touched (V2 only) |