Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No need to wait after Wire.requestFrom() and no Wire.beginTransmission() or endTransmission() should be used with Wire.requestFrom(). #1

Closed
Koepel opened this issue Nov 10, 2017 · 2 comments

Comments

@Koepel
Copy link

Koepel commented Nov 10, 2017

When the Wire.requestFrom() returns, the I2C transaction has completely finished and the received data is waiting in a buffer in the Wire library. There is nothing to wait for after the Wire.requestFrom(). The Wire.available() and Wire.read() only use that buffer, they are not involved in the I2C bus transaction.
The while-loop to wait for something can be removed.

The Wire.beginTransmission() and Wire.endTransmission() are only used when writing data. They should not be used with Wire.requestFrom().

spirituallyinsane added a commit to spirituallyinsane/Arduino-INA219 that referenced this issue Dec 6, 2017
Corrected bus voltage to read out an unsigned value (See Issue jarzebski#2), and applied changes recommended by Koepel in Issue jarzebski#1
@jarzebski
Copy link
Owner

fixed in master

@Koepel
Copy link
Author

Koepel commented May 18, 2023

Please remove this line:

while(!Wire.available()) {};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants