.. module:: BH1750FVI ************** BH1750FVI Module ************** .. _datasheet: https://eu.mouser.com/datasheet/2/348/Rohm_11162017_ROHMS34826-1-1279292.pdf This module contains the Zerynth driver for BH1750FVI digital ambient light sensor. The BH1750FVI features a I2C digital interface. It is possible to detect wide scale at High resolution. (1 - 65535 lx). =============== BH1750FVI class =============== .. class:: BH1750FVI(drvname, addr=0x23, clk=400000) Creates an intance of the BH1750FVI class. :param drvname: I2C Bus used '( I2C0, ... )' :param addr: Slave address, default 0x23 :param clk: Clock speed, default 400kHz Ambient light value can be easily obtained from the sensor: :: from rohm.bh1750fvi import bh1750fvi ... sensor = bh1750fvi.BH1750FVI(I2C0) ambient_light = sensor.get_value() .. method:: set_sensitivity(sensitivity = 1) :param sensitivity: is the sensitivity to set (default value = 1). Sensitivity scale is 0.45-3.68, typical value is 1. Set the sensor sensitivity value. .. method:: get_sensitivity() Return the sensitivity set. .. method:: set_accuracy(accuracy = 1.2) :param accuracy: is the accuracy to set (default value = 1.2). Accuracy scale is 0.96-1.44, typical value is 1.2. Set the sensor accuracy value. .. method:: get_accuracy() Return the accuracy set. .. method:: set_resolution(res = 1) **Parameters**: **res**: is the resolution to set (default value = 1). ======== ===================== res Resolution ======== ===================== 1 One measurement, 1.0 lx resolution 2 One measurement, 0.5 lx resolution 3 One measurement, 4 lx resolution 4 Continous measurement, 1.0 lx resolution 5 Continous measurement, 0.5 lx resolution 6 Continous measurement, 4 lx resolution ======== ===================== Set the sensor resolution value. .. method:: get_resolution() Return the resolution set. .. method:: get_value() Return the ambient light value in lx.