There is absolutely no need for an “exact” timer, but a short one is expected.
This is my configuration:
- the state of the plug is toggled by a push button
- the actual state of the plug is visualised on a led
The push button and led both are part of the mobile device controlling the plug.
When the plug state, as visualised on the led, lags too long behind the push action (e.g. one second), I noticed that people start hitting the push button many times creating more and more traffic on the network and making the plug flip-flopping before it reaches its intended state. That was no problem when the mobile device was directly connected to my local Wifi network sending UDP commands to the plug. Now having introduced blynk for access to the plug over the internet, it looks as if having a receiving function timed at 1 sec is just too slow leading to the above behaviour of the users. I am currently running it OK at 100 ms without any problems and without complaints of the family members.
I might also move the receiving function back in the main loop as it does not do a lot and would not hurt blynk.run but I was merely following the advice to keep the main loop as clean as possible ;-).
Do you see a better way of handling this case?