I can't find the bug

I’d start by reading this:

and make better use of your timers.

Also, you don’t need to do this:

and this:

A single BlynkTimer object can support up to 16 timer instances.

See the “Creating Interval Timers” section of this post:

Also, it’s usual (although not strictly necessary) to use the “V” prefix when referencing virtual pins in BLYNK_WRITE, Blynk.virtualWrite and Blynk.syncVirtual commands so that they’d look like this:

Blynk.virtualWrite(V0, counter);

This would make your code more readable from most Blynkers point of view.

Also, this in your void setup won’t work:

Instead, these Blynk.syncVirtual commands should be in a BLYNK_CONNECTED() callback function
See the “Synchronising the output state with the app at startup” section of this post for more info:

Pete.

1 Like