Closed claws closed 5 years ago
I was disappointed to discover that the readLightLevel function does not return calibrated Lux values. I should have read the device specs better and perhaps elsewhere as well. Anyhow, I proceeded to compare readLightLevel function values to those from a calibrated professional instrument Goldilux GAL 2L Lux meter and here I share some of the results: ( interpret as follows readLightLevel function | Goldilux ) 78 | 178, 53 | 128, 36 | 67, 18 | 28. It appears that the difference is linear.
Closed by #46
After reading a raw value read from the sensor it is converted to lux units by dividing by a conversion factor. This value is typically 1.2. For use in this library where no calibration is being performed the factor is effectively a constant.
The value is currently hard coded in the body of the
readLightLevel
function and looks like a magic number.Perhaps a better alternative (e.g. clean, more maintainable) would be to define it as a constant along with some comments and use the constant. Something like this:
and then later when being used: