ESP8266+Relay+2 Temperature sensors

It’s working. Thanks

Ok, but please try to read the documentation first :slight_smile:
Specified by @shramik_salgaonkar

Best of luck!

Yes, of course.

I have one more question.
When the relay is HIGH, i want to stay it HIGH until the temperature is T1 >= T2+2.

1 Like

You can learn how to “While” :)) but learn IF at first:

if (t1 > t2 + 4 )
{
digitalWrite(relayPin, HIGH);
Serial.println("Relay ON ");
}
else
{
if (digitalRead(relayPin) == HIGH && t1 < t2 + 2)
{
digitalWrite(relayPin, LOW);
Serial.println("Relay OFF ");
}
}