Skip to content

Instantly share code, notes, and snippets.

@ShawnHymel
Last active December 30, 2021 18:46
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 ShawnHymel/41ef4c4c64ea6172e01fdf3da9fe85b4 to your computer and use it in GitHub Desktop.
Save ShawnHymel/41ef4c4c64ea6172e01fdf3da9fe85b4 to your computer and use it in GitHub Desktop.
Adafruit HT16K33 LED matrix backpack test for Raspberry Pi
import board
import busio
import time
from random import random
from adafruit_ht16k33 import matrix
# Initialize LED matrix
i2c = busio.I2C(board.SCL, board.SDA)
eye =matrix.Matrix8x8(i2c)
# Single animation frame
frame = [
[0,0,1,1,1,1,0,0],
[0,1,1,1,1,1,1,0],
[1,1,1,1,1,1,1,1],
[1,1,1,0,0,1,1,1],
[1,1,1,0,0,1,1,1],
[1,1,1,1,1,1,1,1],
[0,1,1,1,1,1,1,0],
[0,0,1,1,1,1,0,0]
]
# Clear matrix
eye.fill(0)
# Loop forever
while True:
# Clear matrix
eye.fill(0)
# Wait for 1 second
time.sleep(1.0)
# Show frame
for y in range(len(frame)):
for x in range(len(frame[y])):
eye[y, x] = frame[x][y]
eye.show()
# Wait for 1 second
time.sleep(1.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment