Last active
November 20, 2021 02:26
-
-
Save extrasleepy/c71f0e6128a11cdcea8c94decc527dd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import board | |
import time | |
import displayio | |
import terminalio | |
# can try import bitmap_label below for alternative | |
from adafruit_display_text import label | |
import adafruit_displayio_sh1107 | |
displayio.release_displays() | |
# oled_reset = board.D9 | |
WIDTH = 128 | |
HEIGHT = 64 | |
BORDER = 2 | |
# Use for I2C | |
i2c = board.I2C() | |
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C) | |
display = adafruit_displayio_sh1107.SH1107(display_bus, width=WIDTH, height=HEIGHT) | |
# Setup the file as the bitmap data source | |
bitmap = displayio.OnDiskBitmap("paw.bmp") | |
# Create a TileGrid to hold the bitmap | |
tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) | |
# Create a Group to hold the TileGrid | |
group = displayio.Group() | |
# Add the TileGrid to the Group | |
group.append(tile_grid) | |
my_text = "Ellie" #add your text here | |
text_area = label.Label( | |
terminalio.FONT, text=my_text, scale=2, color=0xFFFFFF, x=70, y=30) | |
group.append(text_area) #add your text to splash | |
# Add the Group to the Display | |
display.show(group) | |
# Loop forever so you can enjoy your image | |
while True: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment