Skip to content

Common mistakes

Koepel edited this page Mar 24, 2018 · 22 revisions

1

Waiting after calling the Wire.requestFrom(). The Wire.requestFrom() is blocking. It will wait until the I2C bus transaction has finished.
That means that no waiting is needed. If data was received, that data is in a buffer (inside the Wire library) ready to be read with Wire.read().

Using Wire.endTransmission() after a Wire.requestFrom().

The Wire.requestFrom() will do a complete I2C bus transaction with: START, send address, read data, STOP.
The Wire.endTransmission() should only be used when writing data and only together with Wire.beginTransmission().