Last active
December 30, 2021 18:46
-
-
Save ShawnHymel/41ef4c4c64ea6172e01fdf3da9fe85b4 to your computer and use it in GitHub Desktop.
Adafruit HT16K33 LED matrix backpack test for Raspberry Pi
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 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