Skip to content
Stefan Armborst edited this page Dec 31, 2019 · 16 revisions

getLux

this is a blocking function to read the brightness value from the sensor.

float getLux();

result float

The brightness as value calculated as Lux.
Depending at the settings from Quality and MTreg you can get values between 0.11 Lux and 121.557 Lux. See also getRaw().

Hints:

To use this function, a measurement must be started before. startMeasure()
With this function you can not initate a measurement. If you call this function before the measurement was finished, the function returns after the measurement is done.
For a non blocking read please use the function hasValue().
This function can be used several times also in conjunction with getRaw().
If you want to know if the value was already read, you may ask for it with bool processed()

The formula to calculate Lux from the raw value: Lux = raw value / 1.2 * Faktor * 69 / MTreg The faktor is 1 for Quality HIGH and LOW and 0.5 for Quality HIGH2. in the formula above you will notice the value 1.2. This is the conversion faktor to Lux. This value can vary between 0.96 and 1.44. If you calculate the deviation for 100 lux you will get a range between 83 Lux and 125 Lux. With two hacks you even can extend the range to more than 700.000 Lux!

Clone this wiki locally