T500 I2C Communications from Python3 on Beaglebone Black

I cannot figure out how to format the command to set the target position. I’m using the following code which the T500 seems to ignore:

def write(self, addr, fn, data):
    self._bus.write_bytes(addr, fn, data)

def extend(self):
    pos = 320
    data = pos.to_bytes(4, 'little')
    addr = 0x0e << 1    # write
    fn = 0xe0           # set target position
    self.write(addr, fn, pos) 

Based upon chapter 10 I2C Command Encoding, the above should work but doesn’t. The T500’s address is set to the default (14 decimal).

What am I doing wrong?
TIA!
Larry

Hello, Larry.

Thank you for your interest in the Tic T500. I noticed that you are defining a variable named data in your extend method but you are not using it, so you might not be sending the right number of bytes to the Tic. You did not show the code that defines self._bus so I am not sure what I2C library you are using, and I cannot verify that you are calling write_bytes in the right way.

You might consider using the example code from the “Example I²C code for Linux in Python” section of the Tic User’s Guide as your starting point.

Please let me know if you have any further questions.

–David

Thanks for the clarification; the sample code you referenced provided the info needed to get it working. Chapter 10 of the tic.pdf is most confusing.