How to Reset when Disconnected from IOT

I'd like to make it so my Arduino Nano RP2040 Connect resets itself and reconnects when it is disconnected from the internet. as is, it will randomly disconnect or stop working every once in a while and i will have to manually go over and reset it. This is what i tried to use to get it to reset, but i get the 4X long, 4X short blink pattern, which means the Mbed OS crashed. (it works when i remove this code)

before Setup() i have:

 void(* resetFunc) (void) = 0;

Then at the end of loop(), I have

if(!ArduinoCloud.connected()){
         resetFunc();
   }

Maybe there's a more elegant way to do this, that actually works. is there a way to actually test when the Arduino cloud gets disconnected? I would prefer a total reset of the Arduino if it gets disconnected or stops transmitting data. Is this Possible?

I am having a similar issue and looking for a similar solution. I am trying to use MKR1300 and 1310s and often times they fail to connect and if they fail to connect they just continue running the loop. I can see them connecting to TTN, but seems Arduino IOT is rejecting the connection or the board is not getting the accept. I can't prove which of the 2 is happening and I have not found a method of resetting the board when it happens. The debug info on the serial says unable to connect with gateway when it happens I found. That is not correct though because I can see them hit the gateway.

This is what I have done for a ESP32.

https://forum.arduino.cc/t/esp32-disconnects-and-do-not-reconnect-back/1016250/5?u=jarriaga

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.