Best practice with "Blynk.virtualWrite(Vxxx stuffgoesup);"

Hi Guys,

Wondering what the best practice is for “Blynk.virtualWrite”. If you have several timers (15 approx) is it best to have each timer handle its own “Blynk.virtualWrite” for the data you want being sent to blynk servers or is having a timer which has all the “Blynk.virtualWrite” events acceptable also?

For example:

[Unformatted code removed by moderator]

@HKSmonaro Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:

Copy and paste these if you can’t find the correct symbol on your keyboard, the symbol you’ve used at the moment is the wrong one.


here we go, cant edit original post sorry;

void blynkupload1() {

Blynk.virtualWrite(V1, stuff1);
Blynk.virtualWrite(V2, stuff2);
Blynk.virtualWrite(V3, stuff3);
Blynk.virtualWrite(V4, stuff4);
Blynk.virtualWrite(V5, stuff5);
Blynk.virtualWrite(V6, stuff6);
Blynk.virtualWrite(V7, stuff7);
Blynk.virtualWrite(V8, stuff8);
Blynk.virtualWrite(V9, stuff9);
Blynk.virtualWrite(V10, stuff10);
Blynk.virtualWrite(V11, stuff11);
Blynk.virtualWrite(V12, stuff12);
Blynk.virtualWrite(V13, stuff13);

First of all, you need to be careful about your timers.
16 is the maximum for one BlynkTimer object, and you need to set them up so that they don’t all try to get called at the same time, and that if some have longer cycles then a number of timers don’t all coincide at one point (every minute for example).

The “Staggering Timers” section of this tutorial explains more…

As far as your original question is concerned, you’d be better keeping the Blynk.virtualWrite commands in their individual timed functions.
Blynk doesn’t like it if you try to push too much data out to the server at one time, and the preferred limit is 10 write events per second, so trying to do more than 10 immediately after each other isn’t a good idea.


great thanks for that, i have noticed it definitely does block when having allot of “Blynk.virtualWrite” in a timer.

I had split them into two (2) seperate upload timers which helped with a prolonged single perdiod of blocking. How-ever still noticed the impacts, I will look at shift the “Blynk.virtualWrite” into the timer/void/function that generates the value needing to be uploaded.

thanks again for the assistance.


1 Like