I'm having a ESP-01 as i2c master and a Arduino Pro Mini 3.3V 8Mhz as slave.
I can scan the i2c bus and find the Pro Mini slave.
But when i request a response from the slave the bit order of the respons is reversed.
On the ESP-01 Master:
Serial.print("Request from slave, ");
err = Wire.requestFrom(i2cSlaveDeviceId, 2); // request 2 bytes from slave device
Serial.print(err);
Serial.print(" bytes received: ");
while(Wire.available()) { // slave may send less than requested
byte b = Wire.read(); // receive a byte as character
Serial.print(b,DEC); // print the character value
Serial.print(" ");
}
This outputs the bytes "0" and "127" on the serial monitor.
On the Arduino slave:
byte buffer[] = {0,1};
Serial.flush();
Serial.print("i2c send: ");
Serial.print(buffer[0],DEC);
Serial.print(" ");
Serial.println(buffer[1],DEC);
Wire.write(buffer,2);
This of course outputs the bytes "0" and "1" on the serial monitor.
So basically, if the slave sends "00000001" but the master receives "10000000";
Is this a known fact or am I doing something wrong?