I2C experience? Please help :)

I am completely new to I2C, so could someone please explain to me what i recorded with Salae LogicAnalyzer...

Is it writing to address "8" and reading from address "9"?

I am trying to learn I2C to control a factory CD player and display using CDM-M3 4.4 CDdrive, PCF8578 & PCF8579 Colum/Row drivers.

Will this code be the equivalent to what is recorded? At least the first two steps...

#include <Wire.h>

void setup() {
  Wire.begin(); // join i2c bus (address optional for master)
}

void loop() {
  Wire.beginTransmission(8); // transmit to device #8 (0x38)
  // device address is specified in datasheet
  Wire.write(byte(0x00)); // 0 - sends instruction byte
  Wire.write(byte(0x02)); // 2
  Wire.endTransmission(); // stop transmitting
  Wire.requestFrom(9, 3); // request 3 bytes from slave device #9

  delay(500);
}

Is it writing to address "8" and reading from address "9"?

Yes. Typically, you would be writing to, and reading from, the same device, though.

Snake are you trying to add an AUX port to a cadillac cts 2003-2007? Like a proper port via SPDIF and not a monkey left/right analog splice?? :slight_smile:

The wire library uses a 7-bit address and when clocking out that 8th bit, the least significant bit, it is a Read/Write flag.

If you weren't using the wire library you may have to shift the address 1 bit to the left and add in the flag before clocking out the byte. In that case 8 and 9 would be the same address but with the R/W flag swapped.

The way it is written is like the device has two addresses.