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

The Wire.requestfrom() should not be used together with Wire.beginTransmission() or Wire.endTransmission(). #1

Open
Koepel opened this issue Apr 26, 2022 · 0 comments

Comments

@Koepel
Copy link

Koepel commented Apr 26, 2022

The Wire.beginTransmission() and Wire.endTransmission() should only be used when writing data.
The Wire.requestFrom() does the whole I2C session on its own, it should not be used together with those functions to write data.
See also my alternative explanation of the functions of the Wire library.

I noticed a Wire.beginTransmission() and Wire.endTransmission() around a Wire.requestFrom() in the function Arduino_i2c_read() in the file RawButtonDemoCode.ino.
https://github.com/MatrixOrbital/GTT-Arduino-RawButton-Demo/blob/master/ArduinoCode/RawButtonDemoCode/RawButtonDemoCode.ino

Those Wire.beginTransmission() and Wire.endTransmission() may be removed.
Explanation: Common-mistakes, number 2 and 3.

In a other repository is a Wire.beginTransmission() before the Wire.requestFrom(), in the function i2cRead() in the file GTT_Arduino_Thermometer_Demo.ino.
https://github.com/MatrixOrbital/GTT-Arduino-Thermometer-Demo/blob/master/GTT_Arduino_Thermometer_Demo/GTT_Arduino_Thermometer_Demo.ino

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

1 participant