#include <DHT.h>
#include <LiquidCrystal_I2C.h>


#define DHTPIN1 3
#define DHTPIN2 4
#define DHTTYPE DHT22

#define RelePin 13


DHT dht1(DHTPIN1, DHTTYPE); //topeni
DHT dht2(DHTPIN2, DHTTYPE); //mistnotst

LiquidCrystal_I2C lcd(0x27,16,2);


void setup() {
  Serial.begin(115200);

  dht1.begin();
  dht2.begin();

  lcd.init();
  lcd.backlight(); 

  pinMode(RelePin, OUTPUT);

}

void loop() {
  lcd.clear();
  float Teplota1 = dht1.readTemperature();
  float Teplota2 = dht2.readTemperature();

  //Serial.print("Teplota1: ");
  //Serial.print(Teplota1);
  //Serial.print(" Teplota2: ");
  //Serial.println(Teplota2);

  lcd.setCursor (0,0);
  lcd.print (Teplota1);
  lcd.setCursor (0,1);
  lcd.print (Teplota2);

  float RozdilTeplot = Teplota1 - Teplota2;
  lcd.setCursor (7, 0);
  lcd.print (RozdilTeplot);

  if (RozdilTeplot > 4){
    lcd.setCursor (7,1);
    lcd.print ("ZAPNOUT");
    digitalWrite(RelePin, HIGH);
  }
  else{
    lcd.setCursor (7,1);
    lcd.print ("VYPNOUT");
    digitalWrite(RelePin, LOW);
  }

  delay(1000);
}
NOCOMNCVCCGNDINLED1PWRRelay Module