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 #3

Open
Koepel opened this issue Apr 18, 2017 · 1 comment
Open

No need to wait after Wire.requestFrom #3

Koepel opened this issue Apr 18, 2017 · 1 comment

Comments

@Koepel
Copy link

Koepel commented Apr 18, 2017

In the file BMP085.ino https://github.com/cedtat/GY-80-sensor-samples/tree/master/BMP085 there is three times a while-loop after Wire.requestFrom. Those while-loops can be removed.

When the Wire.requestFrom returns, the I2C bus transaction has completely finished and the received data is in a buffer in the Wire library. The Wire.available returns the number of bytes in that buffer. Those bytes can be read from the buffer with Wire.read. There is no need to wait to read something from that buffer (the internal buffer inside the Wire library).

@cedtat
Copy link
Owner

cedtat commented Apr 19, 2017

Thanks for pointing that out ! If you have made those modifications, please create a pull request. I don't work anymore on this project but it might be more effective for others.

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