martinayotte wrote:– got back to sleep
If you wish the ESP to stay alive, you need to remove the hibernate() calls.
Instead I soldered rst pin to gpio16 and now successfully resets but now the problem is sometimes the blue led gets stuck on client side and it won't reset
Secondly someone adviced me to do like below because relay doesn't behave properly sometimes it gets stuck in "ON STATE" SOMETIMES OFF even when it is below the temperature I entered and that guy adviced me :
In the AP code you need to store the received temperature in a global variable called lets say LAST_TEMP, then in the VOID LOOP() function you need to check this variable if its higher than 20 then you close the relay. You can do a function like this and call it in LOOP:
// call this function in the LOOP
void validateRelayState(){
// assign LAST_TEMP when you do the first check above
if(LAST_TEMP > 20){
digitalWrite(2, LOW); // Turn OFF Relay on GPIO2
}
}
Would this work? Shall I change the code like this? And how and where can I store last temp? What is the code for it?