So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By schufti
#66939 there are differences between "ordinary" arduino and esp8266.

obvously you never looked at the debug console to see what is happening with your esp.
or even put some serial output to see where you are or stay in your sketch.

you better rewrite your sketch in a way that it keeps looping, branching on some increasing counter and just executing the "other" branch when the threshold is exceeded.
User avatar
By martinayotte
#66941 It should ... But I don't know why it didn't ...

Another method would be to do it with millis :

Code: Select allunsigned int previous_time = 0; // a global variable

void loop() {
    if ((millis() - previous_time) > 7200000) {
        previous_time = millis();
        // task to be executed after 2 hours
    }
    else {
        // some other task executed every time during the 2 hours wait, such as :
        delay(1000); // 1 second wait
    }
}