I have a similar problem with a PCF8575
in earlier libraries (< 23) i get a result with
i2c.read(0x40,data40i,2); or /* i2c.read(0x40,data40i,2,false);
normaly it must gave me a 255 for data40i[0] and 137 for data40i[1];
now i get 255 for data40i[0] and 0 for data40i[1]
the lower 8 bit are absolutly correct. The bits changed as want. the upper
when i write
i2c.start();
i2c.write(0x42); // Address 0xC0 read
data40i[0] = i2c.read(I2C::ACK); // Read lower 8 bits, with ACK
data40i[1] = i2c.read(I2C::ACK); // Read higher 8 bits, with ACK as philips told in its datasheet
i2c.stop(); // Stop condition
data40i[0]=data40[1]= 192
whats wrong or how can i downgrade the library ?
Thanks
Reading from the ultrasonic rangefinder is like reading from serial memory - an internal memory address needs to be sent followed by a repeat start. I assumed the following lines would do it:
cmd[0] = 0x02; // Set pointer to first echo
sonar.write(addr, cmd, 1, 1); // send address of data register
sonar.read(addr, echo, 2); // read two-byte echo result
It doesn't work though and I'm not sure why...Resorting to the new low-level functions does work:
sonar.start(); // Start condition
sonar.write(addr); // Address write
sonar.write(0x02); // First echo register
sonar.start(); // Repeated start
sonar.write(addr+1); // Address read
echo[0] = sonar.read(I2C::ACK); // Read MSB, with ACK
echo[1] = sonar.read(I2C::NoACK); // Read LSB, no ACK
sonar.stop(); // Stop condition
Any ideas?