From e2fd7d5c493ce6f77280ffb327673c259fe9bfa9 Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Sat, 11 Nov 2023 21:51:36 +0100 Subject: [PATCH] first commit --- thermometer.ino | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 thermometer.ino diff --git a/thermometer.ino b/thermometer.ino new file mode 100644 index 0000000..ec846e8 --- /dev/null +++ b/thermometer.ino @@ -0,0 +1,41 @@ +#include + +int pin_disp = 2; +int pin_dht = 5; +int pin_led_red = 7; +int pin_led_grn = 8; +int pin_disp_clk = 2; +int pin_disp_dio = 3; + +dht11 DHT11; + + +void setup() { + Serial.begin(9600); + +} + +void loop() { + int chk = DHT11.read(pin_dht); + int humd = (float)DHT11.humidity; + int temp = (float)DHT11.temperature; + + Serial.println(); + Serial.print("Humidity (%): "); + Serial.println(humd, 2); + Serial.print("Temperature (C): "); + Serial.println(temp, 2); + + if(temp >= 21) { + digitalWrite(pin_led_grn, HIGH); + digitalWrite(pin_led_red, LOW); + } else { + digitalWrite(pin_led_red, HIGH); + digitalWrite(pin_led_grn, LOW); + } + + + + delay(2000); +} +