Skip to content

Instantly share code, notes, and snippets.

@hierophect
Created September 17, 2020 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hierophect/a8c75eed9725b4e2a3683a9ead61c5f7 to your computer and use it in GitHub Desktop.
Save hierophect/a8c75eed9725b4e2a3683a9ead61c5f7 to your computer and use it in GitHub Desktop.
RGBMatrix Test
import adafruit_display_text.label
import board
import displayio
import framebufferio
import rgbmatrix
import terminalio
import time
displayio.release_displays()
#F4 Version
matrix = rgbmatrix.RGBMatrix(
width=32, height=32, bit_depth=4,
rgb_pins=[board.D6, board.D5, board.D9, board.D11, board.D10, board.D12],
addr_pins=[board.A5, board.A4, board.A3, board.A2],
clock_pin=board.D13, latch_pin=board.D0, output_enable_pin=board.D1)
#ST Version
# matrix = rgbmatrix.RGBMatrix(
# width=32, height=32, bit_depth=4,
# rgb_pins=[board.D13, board.D12, board.D11, board.A4, board.A5, board.D6],
# addr_pins=[board.A0, board.A1, board.A2, board.A3],
# clock_pin=board.D5, latch_pin=board.D9, output_enable_pin=board.D10)
# Associate the RGB matrix with a Display so that we can use displayio features
display = framebufferio.FramebufferDisplay(matrix, auto_refresh=True)
line1 = adafruit_display_text.label.Label(
terminalio.FONT,
color=0xff0000,
text="++++")
line1.x = 4
line1.y = 8
# line2 = adafruit_display_text.label.Label(
# terminalio.FONT,
# color=0x0080ff,
# text="Hello World")
# line2.x = display.width
# line2.y = 24
g = displayio.Group()
g.append(line1)
# g.append(line2)
display.show(g)
while True:
pass
# print(line1.width)
# display.refresh(minimum_frames_per_second=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment