How can I read from a 16 bit address using I2C? I know how to write to it, i.e sending the low bit of the address in the data portion but cannot seem to understand how to read from it. I'm using python btw.
Ok so I managed to read the register using the /dev/i2c-1 file. I am using the os.read function in python like this.
os.write(fd,addr) //sets the register to be read. x = os.read(fd,3) //reads 3 bytes from the specified address.
The problem that I'm having right now is that I cannot store the returned value i.e 0x03 in my variable i.e x. The os.read function documentation says that if the EOF of the file is reached, a null string is returned. So everytime, I read the register, even though I successfully carry out a read, I cannot show it on my terminal by printing out a variable. How can I solve this problem?