Open Koepel opened 7 years ago
Should not be as in it is causing some kind of problem or doesn;t have to be because it is a no op? It seems to be working well for me...
On Wed, Oct 4, 2017 at 4:30 PM, Koepel notifications@github.com wrote:
In the file "VEML6040.ino", the Wire.requestFrom() is followed by a Wire.endTransmission(). You may remove that last Wire.endTransmission() from the getRGBWdata() function.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/VEML6040/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qiyBIW9H_R1p3JF8qw2HKl__N4p4ks5spBUUgaJpZM4PuYCu .
I'm sorry, but it is just plain wrong. It is a bug.
When writing data to a sensor, it is with three functions: Wire.beginTransmission - Wire.write - Wire.endTransmission.
The number of Wire.write can be zero to the maximum of the buffer of the Wire library.
When reading data from a sensor, it is with one function: Wire.requestFrom.
The Wire.requestFrom does the start, send the address, read the data, store it in a buffer, does a stop. After that the Wire.read and/or Wire.available can be used. The Wire.read and Wire.available don't use the I2C bus, they only operate on the buffer inside the Wire library.
Using a Wire.endTransmission on its own (without Wire.beginTransmission) is a bug. It depends on the used Wire library what will happen and if something goes wrong. I can tell you for the Wire library for AVR microcontrollers what will happen, but I don't know what will happen with other Wire libraries.
In the file "VEML6040.ino", the Wire.requestFrom() is followed by a Wire.endTransmission(). You may remove that last Wire.endTransmission() from the getRGBWdata() function.