Skip to content

getMTregTime

Starmbi edited this page Jan 12, 2020 · 4 revisions

getMtregTime

returns the estimated conversion time.

 unsigned int getMtregTime();
 unsigned int getMtregTime(byte mtreg);
 unsigned int getMtregTime(byte mtreg, Quality quality);

result unsigned int

The estimated time in millisecond for the sampling time at a given Quality and MTreg.


Parameter byte mtreg

a value between BH1750_MTREG_LOW (default = 31) and BH1750_MTREG_HIGH (default 254).
see writeMtreg() or working principles for more details.


Parameter BH1750Quality quality

enum BH1750Quality
{
BH1750_QUALITY_HIGH = 0x20,
BH1750_QUALITY_HIGH2 = 0x21,
BH1750_QUALITY_LOW = 0x23,
};

see setQuality for more details.


Hints:

to calculate the estimated conversion time, the Quality and MTreg is needed.
A call to the function with with missing parameters will use the current values.

If you call the function without calibrate the sensor before, you will get up to 50% longer times than the sensor needs.

An example how to obtain the lowest and highest conversion time at a given Quality:

unsigned int low = getMtregTime(BH1750_MTREG_LOW , BH1750_QUALITY_HIGH);
unsigned int high = getMtregTime(BH1750_MTREG_HIGH , BH1750_QUALITY_HIGH);
Clone this wiki locally