Skip to content
Stefan Armborst edited this page Jan 2, 2020 · 16 revisions

getLux

this is a blocking function that reads 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 / luxFactor * Faktor * 69 / MTreg.

The faktor is 1 for Quality BH1750_HIGH and BH1750_LOW and 0.5 for Quality BH1750_HIGH2.

In the formula above you will notice the term luxFactor.
You can adjust this value, to calibrate the sensor.
Please refer to luxFactor for more information.

With two hacks you even can extend the range to more than 700.000 Lux!

Clone this wiki locally