def __init__(self, address=0x70, i2c=None): if i2c is None: i2c = board.I2C() self._matrix = matrix.Matrix16x8(i2c, address) self._matrix.auto_write = False self.columns = 16 self.rows = 8 self._auto_write = True
def __init__(self, address: int = 0x70, i2c: Optional[I2C] = None): if i2c is None: i2c = board.I2C() self._matrix = matrix.Matrix16x8(i2c, address) self._matrix.auto_write = False self.columns = 16 self.rows = 8 super().__init__()
# License: Public Domain # Import all board pins. import time import board import busio # Import the HT16K33 LED matrix module. from adafruit_ht16k33 import matrix # Create the I2C interface. i2c = busio.I2C(board.SCL, board.SDA) # Create the matrix class. # This creates a 16x8 matrix: matrix = matrix.Matrix16x8(i2c) # Or this creates a 16x8 matrix backpack: #matrix = matrix.MatrixBackpack16x8(i2c) # Or this creates a 8x8 matrix: #matrix = matrix.Matrix8x8(i2c) # Or this creates a 8x8 bicolor matrix: #matrix = matrix.Matrix8x8x2(i2c) # Finally you can optionally specify a custom I2C address of the HT16k33 like: #matrix = matrix.Matrix16x8(i2c, address=0x70) # Clear the matrix. matrix.fill(0) # Set a pixel in the origin 0, 0 position. matrix[0, 0] = 1 # Set a pixel in the middle 8, 4 position.
# License: Public Domain # Import all board pins. import time import board import busio # Import the HT16K33 LED matrix module. from adafruit_ht16k33 import matrix # Create the I2C interface. i2c = busio.I2C(board.SCL, board.SDA) # Create the matrix class. # This creates a 16x8 matrix with multiple displays: matrix = matrix.Matrix16x8(i2c, address=(0x70, 0x71)) # Clear the matrix. matrix.fill(0) # Set a pixel in the origin 0, 0 position. matrix[0, 0] = 1 # Set a pixel in the middle 8, 4 position. matrix[8, 4] = 1 # Set a pixel in the opposite 15, 7 position. matrix[15, 7] = 1 # Set pixels in the second display. matrix[16, 7] = 1 matrix[24, 4] = 1 matrix[31, 0] = 1