first commit

This commit is contained in:
Filip Rojek 2023-11-11 21:51:36 +01:00
commit e2fd7d5c49

41
thermometer.ino Normal file
View File

@ -0,0 +1,41 @@
#include <dht11.h>
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);
}