1 changed files with 18 additions and 0 deletions
@ -0,0 +1,18 @@ |
|||||
|
#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)); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue