The Wire.beginTransmission() and Wire.endTransmission() should only be used when writing data. They should not be used together with Wire.requestFrom().
The next files have that:
- g33k/ArduinoProjects/2016 Arduino/PCF8574_Client/PCF8574_Client.ino
- g33k/ArduinoProjects/2016 Arduino/132-PCF8574/PCF8574_I2C_IO_Expander_Explosion/PCF8574_I2C_IO_Expander_Explosion.ino
- g33k/ArduinoProjects/2016 Arduino/132-PCF8574/PCF8574_I2C_IO_Expander_Explosion2/PCF8574_I2C_IO_Expander_Explosion2.ino
- g33k/ArduinoProjects/2016 Arduino/132-PCF8574/PCF8574_I2C_IO_Expander_Explosion3/PCF8574_I2C_IO_Expander_Explosion3.ino
For example this:
Wire.beginTransmission( address );
Wire.requestFrom((int)address, 1); // Ask for 1 byte from slave
val = Wire.read(); // read that one byte
error = Wire.endTransmission();
should be this:
Wire.requestFrom((int)address, 1); // Ask for 1 byte from slave
val = Wire.read(); // read that one byte