Skip to content

Instantly share code, notes, and snippets.

@ace-dent
Last active April 29, 2024 01:37
Show Gist options
  • Save ace-dent/7bc73b4ad466331af0d1917834261a8a to your computer and use it in GitHub Desktop.
Save ace-dent/7bc73b4ad466331af0d1917834261a8a to your computer and use it in GitHub Desktop.
BMO for Thumby
from machine import freq, reset, lightsleep
freq(250_000_000) # Speed up CPU for faster imports
import thumbyGraphics
from thumbyButton import actionPressed
# Tweaks for extended battery life
freq(24_000_000) # Lowest stable CPU frequency
thumbyGraphics.display.brightness(1) # Low brightness
thumbyGraphics.display.setFPS(0) # Minimal frame rate: draws buffer without delay
# 72 x 40 px, fullscreen image
img = bytearray([252,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,252,255,255,255,255,255,255,255,255,255,255,255,255,127,31,15,15,15,31,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,31,15,15,15,31,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,248,248,248,252,255,255,255,255,255,255,255,255,31,15,79,143,79,143,79,143,79,143,79,143,79,143,79,143,79,143,79,143,79,15,31,255,255,255,255,255,255,252,248,248,248,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,248,241,226,229,202,205,206,207,206,207,206,207,206,207,230,231,242,241,248,252,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,63])
thumbyGraphics.display.blit(img, 0, 0, 72, 40, -1, 0, 0)
thumbyGraphics.display.update()
while(True):
lightsleep(2000) # 2 second power nap
# Hold down an action button to exit
if(actionPressed()):
thumbyGraphics.display.fill(0)
thumbyGraphics.display.drawText("Bye bye...", 0, 0, 1)
thumbyGraphics.display.update()
lightsleep(1000) # Delay to read the closing message
reset() # Exit game to main menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment