Skip to content

Frequent calls to readLightLevel prevents measurement update #61

@bjarnebuchmann

Description

@bjarnebuchmann

It seems that in CONTINUOUS modes, frequent calls to readLightLevel prevents the bh1750 module to actually update the measurement. Presumably, the measurement is interrupted by the i2c communication and has to be restarted.
Thus, if I (say) set
lightMeter.configure(BH1750::CONTINUOUS_HIGH_RES_MODE);
and then call readLightLevel with only 100 (or even 120) millis delays, then I keep getting the same value back.
If I increase to, say, 180 millis (max time to make measurement) ,then I get an updated value every time.

If there already is a caveat about this usage, then I apologize for reporting.

I do not see an easy way to circumvent this, except storing (in the object) the previous measurement and time-of-measurement, and not then checking time vs previous time-of-measurement to see if an updated measurement should be ready.

Obviosly, I can avoid the problem by not calling readLightLevel() often. I was just surprised by the effect, and want to report it.

Best,

/Bjarne

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions