BH1750FVI Light Sensor

Driver for the Rohm BH1750FVI ambient light sensor.

BH1750FVI_ADDR_PIN_LOW

ADDR pin := 0.

1
(0x5c)
BH1750FVI_ADDR_PIN_HIGH

ADDR pin := 1.

1
(0x23)
enum @112
BH1750FVI_OK =  0
everything was fine
BH1750FVI_ERR_I2C = -1
error initializing the I2C bus
int bh1750fvi_init(bh1750fvi_t * dev, bh1750fvi_params_t * params)

Initialize the given BH1750FVI device.

Parameters

dev:device descriptor of the targeted device
params:device configuration (i2c bus, address and bus clock)

Return values

  • 0 on success
  • -1 if unable to speak to the device
uint16_t bh1750fvi_sample(const bh1750fvi_t * dev)

Read a ambient light value from the given device [in LUX].

The result value is the measured ambient light intensity in LUX and ranges from 0 to 54612. Taking one measurement takes ~120ms, so it takes this amount of time until the function returns.

Parameters

dev:device descriptor of the targeted device

Return values

  • ambient light intensity in LUX
BH1750FVI_DEFAULT_ADDR

Default address of BH1750FVI sensors.

1
BH1750FVI_ADDR_PIN_HIGH
BH1750FVI_I2C_MAX_CLK

Maximum I2C bus speed to use with the device.

1
I2C_SPEED_FAST
struct bh1750fvi_t

Device descriptor for BH1570FVI devices.

i2c.h::i2c_t i2c

I2C bus the device is connected to.

uint8_t addr

slave address of the device

struct bh1750fvi_params_t

Set of configuration parameters for BH1750FV devices.

i2c.h::i2c_t i2c

I2C bus the device is connected to.

uint8_t addr

slave address of the device