From 8256637dd9178bc8ea7a75122b133961d4140c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=A0krab=C3=A1nek?= Date: Fri, 15 Mar 2024 11:47:01 +0100 Subject: [PATCH] add dht11arduino --- dht11examplegit/dht11examplegit.ino | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 dht11examplegit/dht11examplegit.ino diff --git a/dht11examplegit/dht11examplegit.ino b/dht11examplegit/dht11examplegit.ino new file mode 100644 index 0000000..28c2a9f --- /dev/null +++ b/dht11examplegit/dht11examplegit.ino @@ -0,0 +1,18 @@ +#include + +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)); + } +} \ No newline at end of file