BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Optimizing multiple Blynk.virtualWrite

esp8266
#1

Hi all,

It seems that using multiple Blynk.virtualWrite() functions takes a lot of time.
In my code, 9 virtualWrite takes about 0.9 s, which is a lot.
is there a way to optimize this ? (a MultipleVirtualWrite(), or something ?)

Regards

0 Likes

#2

100ms per, including all the internet transmission time is not that bad.

That same 100ms speed is the lowest setting available for many reading/writing rates in applicable widgets anyhow, so as not to flood the system.

But generally, much will depend on your overall networking speed, as all Blynk.virtualWrite() commands have to…

  • Process on the device
  • Get sent to your router
  • Then to the server
  • And finally to the App

And no, there is no multi-vPin command… However, while I have never used it, you can apparently send multiple values to a single vPin as an array.

http://docs.blynk.cc/#blynk-firmware-virtual-pins-control-blynkvirtualwritevpin-value

// Send multiple values as an array
Blynk.virtualWrite(pin, "hello", 123, 12.34);
0 Likes

#3

Thanks for this answer.
Sending as an array is not a solution since I’m writing to 9 different Vpins (I refresh a few widgets in the app).
I guess this 100 ms are due to the fact that ESP8266 can’t do parallel processing of IP stack and Arduino program.
I think there way be a place for a MultipleWrite, using a single IP frame for multiple widgets. I’ll post the idea for the Blynk Roadmap
Regards

0 Likes

#4

In addition, I guess there is no way of getting the last value that was sent on a virtual pin ? This could be a workaround by avoiding to send a value that was not changed (I could do this on program side, but the less I do, the better I fell :wink:

0 Likes

#5

It’s possible to get Blynk to tell you the current Vpin values, but that’s not the way to go.

It would increase the device to server traffic, and would require more processing on the device than simply having a second set of variables that hold the last values sent to the Vpins then only sending an update if the value has changed.

Pete.

1 Like