https://github.com/mr-addict/dht11
Arduino DHT11 library
https://github.com/mr-addict/dht11
Last synced: 3 days ago
JSON representation
Arduino DHT11 library
- Host: GitHub
- URL: https://github.com/mr-addict/dht11
- Owner: MR-Addict
- Created: 2022-12-14T06:55:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-14T07:13:28.000Z (over 3 years ago)
- Last Synced: 2025-01-12T12:47:07.364Z (over 1 year ago)
- Language: C++
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Arduino DHT11 Library
## 1. Functions and Constants
| Name | Type | Intro |
| ----------- | --------- | ------------------------------------------------------ |
| update() | Function | return true if update successfully,else will be false |
| temperature | Constants | this value will update after calling update() function |
| humidity | Constants | this value will update after calling update() function |
## 2. Examples
```cpp
#include
const uint8_t dht11_pin = 2;
DHT11 dht11(dht11_pin);
void setup() {
Serial.begin(115200);
}
void loop() {
if (dht11.update()) {
Serial.print("DHT11 Okay,humidity is ");
Serial.print(dht11.humidity);
Serial.print(", temperature is ");
Serial.println(dht11.temperature);
} else {
Serial.println("DHT11 ERROR!");
}
delay(2000);
}
```
> Attention:
>
> - According to DHT11 datasheet, intervals between every sensor update should be at least **2 seconds**.