Blynk.syncVirtual

Hello, a simple question…
When I write:

Blynk.syncVirtual(V9) ;

What happens at the variable “speed”?

BLYNK_WRITE(V9){speed = 51*param.asInt();} 

Depends… what is the widget on V9?

Your code seems to multiply whatever the widget value is… so well, that is what would happen, but just using whatever the last value was/is, instead of a new value… as if you adjusted the widget.

So… the sync command basically calls the server to run the associated function (emulating you touching the widget) but using whatever was the last state or data value used.

It can be a way of restoring App setting to a restarting device, or giving a device a way of cyclically updating and processing a widget state (aka processing a value change and providing that feedback to a slider, button, etc.)

V9 is a slider…

I’d like that when i use “Blynk.syncVirtual(V9) ;” the variable “speed” updates its value…

You have to change that value first… either by physically moving the slider (which would automatically update the BLYNK_WRITE() function anyhow, or sending a Blynk.virtualWrite() command to that vPin, prior to the sync. (AKA that feedback method I mentioned)

ok, thanks