Matrix 8x8 Pixel

CircuitPython Code

The following example will illuminate the matrix rows and columns one pixel at a time.

# Import all board pins.
import time
import board
import busio
from adafruit_ht16k33 import matrix

# Create the I2C interface.
i2c = busio.I2C(board.SCL, board.SDA)

# creates a 8x8 matrix:
matrix = matrix.Matrix8x8(i2c)

# edges of an 8x8 matrix
col_max = 8
row_max = 8

# Clear the matrix.
col = 0
row = 0

while True:

    # illuminate a column one LED at a time
    while col < col_max:
        matrix[row, col] = 2
        col += 1

    # next row when previous column is full
    if row < row_max:
        row += 1
        col = 0

    # clear matrix, start over
        row = col = 0

Download and Run the Code

We can easily copy this code onto our Pi's home directory using the 'wget' command and then run it using the following commands.

Download: file
python3 ./
Which should result in something like the following:
This guide was first published on Aug 24, 2012. It was last updated on Aug 24, 2012.
This page (Matrix 8x8 Pixel) was last updated on Jul 08, 2020.