Blynk Edgent Offline functionality

Hi,
I would like to know if there is any recommended strategy to incorporate a piece of code that works when the device is not connected to Blynk, up until the connection is recovered.
The device is uses BlynkEdgent.
I have seen a couple of messages, but I haven´t found a clear guideline on how to proceed in this case.

Thank you in advance for your help

What does your device do? Read temp? Read humidity? Or control any relay?

We need more information.

BTW you can use ISR to keep the device running even when the internet is out.

You can try your luck with freeRTOS.

1 Like

Thank you for the replies…sorry for the delay in the conversation.
The functionality is to allow the reset button (same for resetting Blynk WiFi credentials) to change the pages on an OLED display.
I understand ISR is an option; when I have tried a very simple one within the ResetButton.h, most of the times leads to reseting the device (not the WiFi credentials).
The question is, where should I insert the attachInterrupt function, so it works, even when Blynk or WiFi connection is not established?
Thanks again

Resetting means the device will erase the current wifi credentials stored on the EEPROM and turns the device into a hotspot so that the app can connect to it and configure with new wifi credentials.

What do you mean resetting the device and not wifi credentials in your case?

You shouldn’t mess with the .h files of the example unless you know what you’re doing.

The interrupt handler and its declaration should go in your .ino file.

Pete.

Thank you Pete, this is helpful.
I will try as soon as I can tomorrow, but something tells me that calling 2 attachInterrupt on the same pin, at the same action (CHANGE) to execute 2 different functions…will not work.
I come tomorrow with the testing results.
To Madhukesh, sorry I misused the word resetting. I meant re-initialise the ESP32. Like power off and on.
Thanks again

Correct.
You need to read the value of the pin in the ISR and take the appropriate action. However, some denounce code is also going to be needed.

Pete.

If you you using esp8266 you can use this library

There is also a lib for ESP32 as well. You can get it on github. Study the example and incorporate your sketch into it.

I have used it and using it and its stable. The sketch runs even when there is internet or not or wifi router.

Give this a try.