#include <DHT.h>
#include <ESP32Servo.h>
Servo okno;
float humidity, temp, oknno;
DHT dht(4, DHT22);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(18, OUTPUT);
pinMode(19, OUTPUT);
dht.begin();
okno.attach(16);
// okno.write(0);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
humidity=dht.readHumidity();
temp=dht.readTemperature();
Serial.println(humidity);
Serial.println(temp);
if (temp > 25){
okno.write(180);
}
if (temp <=25){
okno.write(0);
}
if (humidity > 61){
digitalWrite(19, 1);
digitalWrite(18, 0);
}else{
digitalWrite(19, 0);
}
if (humidity < 29){
digitalWrite(18, 1);
digitalWrite(19, 0);
}else{
digitalWrite(18,0);
}
}