mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-11-16 10:55:21 +01:00
33 lines
956 B
ReStructuredText
33 lines
956 B
ReStructuredText
HTU21D Temperature/Humidity Sensor
|
|
==================================
|
|
|
|
The HTU21D component allows you get accurate temperature and humidity readings from your HTU21D
|
|
(`datasheet <https://cdn-shop.adafruit.com/datasheets/1899_HTU21D.pdf>`_,
|
|
`adafruit <https://www.adafruit.com/product/1899>`_) sensors with esphomelib. To use these
|
|
i2c-based devices, first initialize the i2c bus using the pins you have for SDA and SCL and
|
|
then create the sensors themselves as in below example.
|
|
|
|
Example Usage
|
|
-------------
|
|
|
|
.. code-block:: cpp
|
|
|
|
// inside setup()
|
|
App.init_i2c(SDA_PIN, SCL_PIN); // change these values for your pins.
|
|
// create sensors
|
|
App.make_htu21d_sensor("Outside Temperature", "Outside Humidity");
|
|
|
|
.. cpp:namespace:: nullptr
|
|
|
|
See :cpp:func:`Application::make_htu21d_sensor`.
|
|
|
|
API Reference
|
|
-------------
|
|
|
|
.. cpp:namespace:: nullptr
|
|
|
|
.. doxygenclass:: sensor::HTU21DComponent
|
|
:members:
|
|
:protected-members:
|
|
:undoc-members:
|