The friendly Operating System for the Internet of Things
BH1750FVI Light Sensor

Driver for the Rohm BH1750FVI ambient light sensor. More...

Detailed Description


file  bh1750fvi_internal.h
 Command definition for the BH1750FVI light sensor.
file  bh1750fvi.h
 Interface definition for the Rohm BH1750FVI ambient light sensor.

Data Structures

struct  bh1750fvi_t
 Device descriptor for BH1570FVI devices. More...
struct  bh1750fvi_params_t
 Set of configuration parameters for BH1750FV devices. More...


 Default address of BH1750FVI sensors.
 Maximum I2C bus speed to use with the device.


enum  { BH1750FVI_OK = 0, BH1750FVI_ERR_I2C = -1 }
 Status and error return codes. More...


int bh1750fvi_init (bh1750fvi_t *dev, bh1750fvi_params_t *params)
 Initialize the given BH1750FVI device. More...
uint16_t bh1750fvi_sample (bh1750fvi_t *dev)
 Read a ambient light value from the given device [in LUX]. More...
#define BH1750FVI_ADDR_PIN_LOW   (0x5c)
 Possible I2C bus addresses of the device. More...
#define BH1750FVI_ADDR_PIN_HIGH   (0x23)
 ADDR pin := 1.

Macro Definition Documentation

#define BH1750FVI_ADDR_PIN_LOW   (0x5c)

The actual address of the device depends on the state of the ADDR pin.ADDR pin := 0

Definition at line 36 of file bh1750fvi.h.

Enumeration Type Documentation

anonymous enum

everything was fine


error initializing the I2C bus

Definition at line 54 of file bh1750fvi.h.

Function Documentation

int bh1750fvi_init ( bh1750fvi_t dev,
bh1750fvi_params_t params 
[out]devdevice descriptor of the targeted device
[in]paramsdevice configuration (i2c bus, address and bus clock)
0 on success
-1 if unable to speak to the device
uint16_t bh1750fvi_sample ( bh1750fvi_t dev)

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.

[in]devdevice descriptor of the targeted device
ambient light intensity in LUX