commit e2fd7d5c493ce6f77280ffb327673c259fe9bfa9 Author: Filip Rojek Date: Sat Nov 11 21:51:36 2023 +0100 first commit 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); +} +