# Lighting up LEDS via I2C Bus of a NeoTrellis 4x4 RGB Led Matrix

Many attempts to write to an i2c slave to make rgb leds light up have failed.

The hardware in question is found at: https://learn.adafruit.com/adafruit-neotrellis

There is an arduino library and a python library, but its hard to find out what i2c register does what.

My attempt, in python, is as follows:

i2c.writeto(0x2E, bytes([0x0E,0x01,0x01]), stop=True) # pin = 1 (as it is PORT A Pin 1 ??
i2c.writeto(0x2E, bytes([0x0E,0x02,0x00,0x00]), stop=True) # speed = 400khz  ?
i2c.writeto(0x2E, bytes([0x0E,0x03,0x06,0x06]), stop=True) # buff length?
i2c.writeto(0x2E, bytes([0x0E,0x04, 0x00, i, 0xff,0xff,0xff]), stop=True) # buff?
i2c.writeto(0x2E, bytes([0x0E,0x05,0x01]), stop=True) # show


The slave address is correct, and I get a response. I got my register constants from the following c-header file: https://adafruit.github.io/Adafruit_Seesaw/html/_adafruit__seesaw_8h.html

I got my info from the following document on page 30 / 38

Here is the log of the commands from a logic analysor

What can I do to get the leds to light up? I've used i2cdump without success, is there some brute force method to try out all combinations? What suggests do you have?

EDIT I realized that SPEED is supposed to be 8 bit not 16 bit but thats not really an issue.

The following code fixed things,

time.sleep(0.5)
i2c.writeto(0x2E, bytes([0x00,0x7f,0xff]), stop=True)       # ???

time.sleep(0.5)
i2c.writeto(0x2E, bytes([0x00,0x01]), stop=True)       # read id
result = bytearray(1)
time.sleep(0.5)
print("module id=")
print(''.join('{:02x}'.format(x) for x in result))

i2c.writeto(0x2E, bytes([0x0E,0x02,0x01]), stop=True)  # speed = 200khz
time.sleep(0.5)
i2c.writeto(0x2E, bytes([0x0E,0x03,0x00,0x30]), stop=True)  # buff length
time.sleep(0.5)
i2c.writeto(0x2E, bytes([0x0E,0x01,0x03]), stop=True)       # pin = 3

i2c.writeto(0x2E, bytes([0x00,0x01]), stop=True)       # read id
result = bytearray(1)