2018-05-13 11:37:02 +02:00
|
|
|
TSL2561 Ambient Light Sensor
|
|
|
|
============================
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
This sensor is experimental has not been tested yet. If you can verify it works (or if it doesn't),
|
2018-05-16 20:02:48 +02:00
|
|
|
notify me on `discord <https://discord.gg/KhAMKrd>`__.
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
The TSL2561 sensor allows you to use your TSL2561 i2c-enabled ambient light sensor with
|
|
|
|
esphomelib (`datasheet <https://cdn-shop.adafruit.com/datasheets/TSL2561.pdf>`__,
|
|
|
|
`Adafruit <https://www.adafruit.com/product/439>`__). It requires i2c to be setup to work.
|
|
|
|
|
|
|
|
Example Usage
|
|
|
|
-------------
|
|
|
|
|
|
|
|
.. code-block:: cpp
|
|
|
|
|
|
|
|
// Basic
|
|
|
|
auto tsl2561 = App.make_tsl2561_sensor("TSL2561 Illuminance Sensor");
|
|
|
|
|
|
|
|
// Advanced settings
|
|
|
|
// set the time the sensor will take for value accumulation, default: 402 ms
|
|
|
|
tsl2561.tsl2561->set_integration_time(sensor::TSL2561_INTEGRATION_14MS);
|
|
|
|
// set a higher gain for low light conditions, default: 1x
|
|
|
|
tsl2561.tsl2561->set_gain(sensor::TSL2561_GAIN_16X);
|
|
|
|
|
2018-05-14 21:15:49 +02:00
|
|
|
.. cpp:namespace:: nullptr
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
See :cpp:func:`Application::make_tsl2561_sensor`.
|
|
|
|
|
|
|
|
API Reference
|
|
|
|
-------------
|
|
|
|
|
|
|
|
.. cpp:namespace:: nullptr
|
|
|
|
|
|
|
|
.. doxygenclass:: sensor::TSL2561Sensor
|
|
|
|
:members:
|
|
|
|
:protected-members:
|
|
|
|
:undoc-members:
|
|
|
|
|
|
|
|
.. doxygenenum:: sensor::TSL2561IntegrationTime
|
|
|
|
.. doxygenenum:: sensor::TSL2561Gain
|