How to use timer offline

I’m trying to run functions on a timer, because as it says in the documentation it’s better to exclude the delay() function, but there is a problem in which the BlynkTimer class does not work offline (and this can still be understood) so I tried to use SimpleTimer but as I understand it extends into BlynkTimer and also does not start without connecting to the server, what should I do?

#include <Arduino.h>
#include <Ethernet2.h>
#include <BlynkSimpleEthernet2.h>


BlynkTimer testtimer;
SimpleTimer testtimer1;


void testfunc()
{
  Serial.println(millis());
}



void setup() {

Blynk.begin("2XXPpmeB1MX0jhKApEBvXiCgXlzwrG_3");

Serial.begin(9600);

testtimer.setInterval(1000,testfunc);
testtimer1.setInterval(1000,testfunc);
}



void loop() {

testtimer1.run();
testtimer.run();
Blynk.run();


}

That’s incorrect.
BlynkTimer is a variation on SimpleTimer, and neither of them require an internet connection to function.

What you’re probably witnessing is the fact that Blynk.begin is a blocking function, and if it can’t establish a connection to either WiFi or the Blynk server it will stop all code execution at that point.

If you wnat offline functionality then you’ll need to attempt a WiFi connection manually and if that is successful use Blynk.config and Blynk.connect instead.

Pete.

if so, why does Serial stop outputting the millis() value when the ethernet cable is disconnected?

I just want some functions to continue to be called on a timer and without connecting to the server and I thought that this would get by with the SimpleTimer call

Because you’re using Blynk.begin().

As I explained, that’s not the solution.

Pete.