Skip to content

Instantly share code, notes, and snippets.

@ShawnHymel
Last active December 30, 2021 18:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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