GY-63_MS5611/libraries/DHT12
2021-05-28 13:17:38 +02:00
..
.github/workflows add arduino-lint 2021-05-28 13:17:38 +02:00
examples 2021-01-29 2021-01-29 12:31:58 +01:00
test 2021-01-29 2021-01-29 12:31:58 +01:00
.arduino-ci.yml 2021-01-29 2021-01-29 12:31:58 +01:00
DHT12.cpp 2021-01-29 2021-01-29 12:31:58 +01:00
DHT12.h 2021-01-29 2021-01-29 12:31:58 +01:00
keywords.txt 2021-01-29 2021-01-29 12:31:58 +01:00
library.json 2021-01-29 2021-01-29 12:31:58 +01:00
library.properties 2021-01-29 2021-01-29 12:31:58 +01:00
LICENSE 2021-01-29 2021-01-29 12:31:58 +01:00
README.md 2021-01-29 2021-01-29 12:31:58 +01:00

Arduino CI License: MIT GitHub release

DHT12

Arduino library for I2C DHT12 temperature and humidity sensor.

Description

The library should be initiated by calling the begin() function, optionally begin(datapin, clockpin) for ESP32 and similar platforms.

Thereafter one has to call the read() function to do the actual reading, and with getTemperature() and getHumidity() to get the read values. Calling these latter again will return the same values until a new read() is called.

Interface

Constructor

  • DHT12(TwoWire *wire) constructor, using a specific Wire (I2C bus).
  • begin(dataPin, clockPin) begin for ESP32 et al, to set I2C bus pins
  • begin() initializer for non ESP32.

Core

  • read() read the sensor and store the values intenally. It returns the status of the read which should be 0.
  • getHumidity() returns last Humidity read, or -999 in case of error.
  • getTemperature() returns last Temperature read, or -999 in case of error.

Offset

  • void setHumOffset(float offset) set an offset to calibrate (1st order) the sensor.
  • float getHumOffset() return current offset, default 0.
  • void setTempOffset(float offset) set an offset to calibrate (1st order) the sensor
  • float getTempOffset() return current offset, default 0.

version 0.3.0

  • The members temperature and humidity became private in 0.3.0.
  • added offset for temperature and humidity.

Operation

See examples