Hello all,
I bought QWIIC Scale together with Qwiic HAT and 1kg load cell . I am using RPI4. I wrote some python code to read the values based on the Arduino platform. The problem is that the values (read from register 12/13/14) varies from 0 to 16777215. The connections I think that are good. I initialized the chip writing 0x6 in register 0x0 .
def Scale_getValue():
status = 0
myDeviceAddress = qwiic.scan()[0]
if qwiic_i2c.isDeviceConnected(myDeviceAddress):
with qwiic_i2c.getI2CDriver() as i2c:
status = i2c.readWord(myDeviceAddress,0x0)
if (status & (1<<3)):
status=1
else:
status=0
if (status == 0):
i2c.writeWord(myDeviceAddress,0x0,0x6)
Scale_getValue()
else:
raw= i2c.readBlock(myDeviceAddress,0x12,3)
value = raw[0]<<16
value = value | raw[1]<<8
value = value | raw[2]
return value
What do you think that the problem is?