Tic Device number (serial command)

I’ve have my Tic controllers being controlled via serial commands. I am using Python scripts. I’ve hit a bit of a issue trying to determine the device number. My Tic controllers have device numbers 1, 2, 3, 4, 5, 6, 7, 8

I’ve had no luck getting anything that makes sense, I am not using an alternative device number. My thought was that (0x07, 7) would yield a byte array like (b’\x00\x00\x00\x00\x01\x00\x01’) for device number 5 for example. Which normal, I figured I could do b[0] + b[1]*2 + b[3]*4 + b[4]*8, or some such operation.

The function I’ve written is as such:

 def get_device_num(self):
    b = self.get_variables(0x07,7)
    type_var = str(type(b))
    fd.write("drive var is: " + type_var + "\n")
    fd.write("drive num is: " + str(b) + "\n")
    device_num = b
    return device_num

I realize this is just going to print out the byte array (in the fd.write line) the results are confusing, in that the byte array is as such.
In some instances I get:
drive num is: bytearray(b’\x00\x00\x0061\x00\x00’)
in others I get:
and others bytearray(b’\x00\x00\x00\xd1I\x00\x00’)

I am clearly not understanding how to extract the device number.


The “Serial device number” on the Tic is a setting, which is different from a variable. The “Get setting” command should be used to read the serial device number. You can find more information about the “Get setting” command in the “Command reference” section of the Tic user’s guide

Additionally, please note that the lower 7 bits of the device number are stored in the lower 7 bits of the settings byte at offset 0x07. Since all of your device numbers are small enough, you should only need to read a single byte back. If your device numbers were larger and you needed to read the upper 7 bits as well, they are stored in the lower 7 bits of the settings byte at offset 0x69, as described in the “Serial device number” entry of the “Setting reference” section of the Tic user’s guide.