I am using BlynkTimer for physical switch operation, when blynk is connected it works so well but when blynk is disconnected then physical switch response lags by 2-3 seconds. I am running (inside loop()) blynk.run() only when the device is connected to blynk server but the timer.run() is always running in loop() as I need to use physical switch when blynk is not connected.
Here my guess is BlynkTimer also tries to connect with Blynk server and it consumes 2-3 seconds, please advise, thank you!!
Are you using a test in your void loop that says something like this:
If so, you’re doing this Blynk.connected test every time the void loop executes. I’m not sure how long it takes for Blynk.connected to be evaluated, but this may be adding to the processing time.
If you want to eliminate any doubts about BlynkTimer then try using SimpleTimer instead.
Thank you for your response on this, I am calling separate function every 30 second outside main loop() to check if Blynk is connected, if not then connect. This function sets a flag which is being used in main loop() to trigger Blynk.run().
As you suggested, I will try using SimpleTimer, thank you!!
BlynkTimer was not causing the delay, it was a function in my program which is being called every 3 second and it was having Blynk.run() as part of it, now I have removed this Blynk.run() from the function and all is working fine now. Hence BlynkTimer do not try to connect Blynk server in the absence of Blynk.run().