A wrapper module for reading values provided by TSL2561 Digital Light Sensor.


tsl2561.get_reading(sda_pin, scl_pin, vcc_pin=None)

Returns the light intensity, for given I2C SCL/SDA and VCC pins. If vcc_pin is defined it will first power on sensors and it will power off sensors at the end.

Assumes that the i2c address is: 0x39

from sensors import tsl2561
light = tsl2561.get_reading('P9', 'P10')
  • params
    • sda_pin: i2c SDA pin.
    • scl_pin: i2c SCL pin.
    • vcc_pin: (optional) the pin that controls the power to the sensors.
  • returns
    • light: integer value indicating the Lux value
Based on [https://github.com/adafruit/micropython-adafruit-tsl2561/blob/master/tsl2561.py].
Extensions: Added a wrapper function for getting directly the values