0

I have bought a pre-built 8x8 LED matrix powered by an ht16k33 and connected it to a Raspberry Pi 3b. I have created the following test program, which should turn on each of the LEDs of an 8x8 matrix in turn:

import time
import board
import busio

from adafruit_ht16k33 import matrix

i2c = busio.I2C(board.SCL, board.SDA)

matrix = matrix.Matrix8x8(i2c)

while True:
    matrix.fill(0)
    for x in range(0, matrix.columns):
        for y in range(0, matrix.rows):
            matrix.pixel(x, y, 1)
            time.sleep(0.1)

The program does this, but the LEDs are controlled in an unexpected order. I'd expect the matrix columns to be lit up in this pattern:

12345678

This is the order in which they are being triggered instead - the "last" column lights up first, followed by the opposite one, then each sequential column:

23456781

I've tried different I2C address settings with the same result - I've also tried starting x from 1 and counting to columns + 1, but this just results in the last column not being lit at all.

Is this a coding issue, a wiring issue, a bad component, or expected functionality that I don't understand yet?

4
  • I'd expect the matrix columns to be lit up in this pattern: 12345678 ... is that order specified in the LED matrix datasheet?
    – jsotola
    Feb 8 at 23:52
  • 1
    try range 0 to 7
    – jsotola
    Feb 8 at 23:54
  • @jsotola it's a 1088BS LED matrix, the datasheet I found shows the columns and rows being numbered sequentially. If I limit the range to 0-7 instead the program still works, but only part of the matrix is illuminated.
    – drewb
    Feb 9 at 0:08
  • You might try changing the for x in range(0, matrix.columns): to for x in (7,0,1,2,3,4,5,6): to see if that is correct.
    – bstipe
    Feb 10 at 19:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.