Created
August 9, 2020 13:50
-
-
Save FoamyGuy/96819969b1632058846e71bdbadda2bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#code for Metro M4 with custom UF2 to make regular 32x16 RGB Matrix work | |
import board | |
import displayio | |
import framebufferio | |
import rgbmatrix | |
import adafruit_imageload | |
#displayio.release_displays() | |
# don't get hung up on this code | |
# it's my pin out for my shiled and it has been tested to work | |
""" | |
matrix = rgbmatrix.RGBMatrix( | |
width=32, height=16, bit_depth=1, | |
# change pins to match RGB shield mods | |
rgb_pins=[board.D2, board.D3, board.D4, board.D5, board.D6, board.D7], | |
addr_pins=[board.A0, board.A1, board.A2], | |
clock_pin=board.A4, latch_pin=board.D8, output_enable_pin=board.D9) | |
display = framebufferio.FramebufferDisplay(matrix, auto_refresh=False) | |
""" | |
display = board.DISPLAY | |
# code from: https://learn.adafruit.com/circuitpython-display-support-using-displayio/display-a-bitmap | |
# bmp from https://learn.adafruit.com/circuitpython-display-support-using-displayio/sprite-sheet | |
bitmap, palette = adafruit_imageload.load("/cp_sprite_sheet.bmp", | |
bitmap=displayio.Bitmap, | |
palette=displayio.Palette) | |
# Create a TileGrid to hold the bitmap | |
tile_grid = displayio.TileGrid(bitmap, pixel_shader=palette) | |
# Create a Group to hold the TileGrid | |
group = displayio.Group() | |
# Add the TileGrid to the Group | |
group.append(tile_grid) | |
# 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