You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
409 B
19 lines
409 B
#include <DHT11.h>
|
|
|
|
DHT11 dht11(2);
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
}
|
|
|
|
void loop() {
|
|
int temperature = dht11.readTemperature();
|
|
|
|
if (temperature != DHT11::ERROR_CHECKSUM && temperature != DHT11::ERROR_TIMEOUT) {
|
|
Serial.print("DHT11: ");
|
|
Serial.print(temperature);
|
|
} else {
|
|
Serial.print("ERROR: ");
|
|
Serial.println(DHT11::getErrorString(temperature));
|
|
}
|
|
}
|