46 if (addrPinLevel == HIGH) {
82 _completionTimestamp = 0;
111 if (_completionTimestamp && (millis() >= _completionTimestamp)) {
141 for (uint8_t i = 0; i < (timeout + 2); i++) {
174 _completionTimestamp = 0;
180 Wire.requestFrom((
int) _i2cAddr, 2);
183 level = (uint16_t) Wire.read();
185 level |= (uint8_t) Wire.read();
192 level = ((((uint32_t) level) * 10) + 5) / 12;
206 _completionTimestamp = millis() +
GET_TIMEOUT(_mode);
217 Wire.beginTransmission(_i2cAddr);
218 Wire.write(instruction);
219 Wire.endTransmission();
BH1750_Resolution_e
Resolution register bits.
bool waitForCompletion()
Wait for completion.
#define BH1750_I2C_ADDR_H
I2C address with ADDR pin high.
#define BH1750_MODE_MASK
Mode mask bits.
BH1750_Mode_e
Mode register bits.
void writeInstruction(uint8_t instruction)
Write instruction to sensor.
#define BH1750_POWER_DOWN
Power down instruction.
BH1750(uint8_t addrPinLevel=LOW)
Constructor.
#define GET_TIMEOUT(mode)
void powerDown()
Power down. Call startConversion() to power-up automatically.
#define BH1750_I2C_ADDR_L
I2C address with ADDR pin low.
#define BH1750_CONV_TIME_H
Worst case conversion timing high res.
#define IS_INITIALIZED(mode)
#define BH1750_RES_MASK
Mode resolution mask bits.
BH1750 digital light sensor library for Arduino.
BH1750 digital light sensor library for Arduino.
#define IS_ONE_TIME_MODE(mode)
void begin(BH1750_Mode_e mode, BH1750_Resolution_e resolution)
Set mode and resolution.
#define BH1750_CONV_TIME_L
Worst case conversion timing low res.
#define IS_CONTINUES_MODE(mode)
void setTimestamp()
Save current time + minimum delay before reading next conversion in ms.
bool isConversionCompleted()
Wait for completion.
#define IS_LOW_RESOLUTION(mode)
uint16_t read()
Read light level asynchronous from sensor The application is responsible for wait or checking a compl...
void startConversion()
Start conversion.