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:
bytearray(b’\x00\x00\x00lb\x00\x00’)
and others bytearray(b’\x00\x00\x00\xd1I\x00\x00’)
I am clearly not understanding how to extract the device number.