File tree Expand file tree Collapse file tree
Matrix_7-Segment_LED_Backpack_Raspberry_Pi Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Matrix_7-Segment_LED_Backpack_Raspberry_Pi
2+
3+ Code to accompany this tutorial:
4+ https://learn.adafruit.com/matrix-7-segment-led-backpack-with-the-raspberry-pi/
Original file line number Diff line number Diff line change 1+ # Import all board pins.
2+ import time
3+ import board
4+ import busio
5+ from adafruit_ht16k33 import matrix
6+
7+ # Create the I2C interface.
8+ i2c = busio .I2C (board .SCL , board .SDA )
9+
10+ # creates a 8x8 matrix:
11+ matrix = matrix .Matrix8x8 (i2c )
12+
13+ # edges of an 8x8 matrix
14+ col_max = 8
15+ row_max = 8
16+
17+ # Clear the matrix.
18+ matrix .fill (0 )
19+ col = 0
20+ row = 0
21+
22+ while True :
23+
24+ # illuminate a column one LED at a time
25+ while col < col_max :
26+ matrix [row , col ] = 1
27+ col += 1
28+ time .sleep (.2 )
29+
30+ # next row when previous column is full
31+ if row < row_max :
32+ row += 1
33+ col = 0
34+
35+ # clear matrix, start over
36+ else :
37+ row = col = 0
38+ matrix .fill (0 )
You can’t perform that action at this time.
0 commit comments