An open API service indexing awesome lists of open source software.

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

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**.