Consider the following basic code snippet taken from the i2c wire example here :
My question is this: assume device 0 is a little slow to respond and immediately after sending the "requestFrom" it hasnt responded with its data, wire.available will probably return 0.
A short while later i ask device 1 for its data and in the meantime device 0 has responded and put its data on the bus, will wire.receive now return device 0's data?
Code:
// read 1 byte, from address 0
[B] Wire.requestFrom(80, 1);[/B]
while(Wire.available()) {
num = Wire.receive();
}
Serial.print("num0 = ");
Serial.println(num, DEC);
// read 1 byte, from address 1
[B] Wire.requestFrom(81, 1);[/B]
while(Wire.available()) {
num = Wire.receive();
}
Serial.print("num1 = ");
Serial.println(num, DEC);
My question is this: assume device 0 is a little slow to respond and immediately after sending the "requestFrom" it hasnt responded with its data, wire.available will probably return 0.
A short while later i ask device 1 for its data and in the meantime device 0 has responded and put its data on the bus, will wire.receive now return device 0's data?