Button Pressed 3 seconds to return to Access Point mode with ClientListener, and in the loop (); with thing.handle ();

I woudl suggest you try with the client listener, check this topic:

With this conditions (and cloud as a global boolean variable of course):

switch(state){
    case THINGER_AUTHENTICATED:
        // Everything is going well
        cloud =1;
        break;
    default:
     cloud = 0;
        break;
}

And in the loop(); you may take decisions accordingly, note that you will need to call sometime the thing.handle() function to try to connect again.

On other hand, if you need to avoid timelapses without controlling a process, and the communication is secondary, I would recommend you use the ESP32, as it is dual core, so you can dedicate one core to the process control and the other to communicate, so one task will not interfere with the other, check this topic:

Hope this helps.

1 Like