Cannot sync data from virtual pin V0 to hardware device

I wrote data from physical pin to virtual pin.
When pressed button state of virtual pin V0 on App changed, but on device couldnt sync that data.
Please help me this case.

Thanks

#include "header.h"
#include "BlynkEdgent.h"


BlynkTimer timer;


BLYNK_CONNECTED() {
  Blynk.syncVirtual(V0); // get the latest value
}


// When App button is pushed - switch the state
BLYNK_WRITE(V0) {
  ledState = param.asInt();
  digitalWrite(ledPin, ledState);
}



void setup()
{
  Serial.begin(115200);
  delay(100);
  pinMode(button, INPUT_PULLUP);
  pinMode(ledPin, OUTPUT);
  //Connecting to Blynk Cloud
  Blynk.begin(auth, ssid, pass);

  timer.setInterval(100L, readInput);
  Serial.println("Connected!");

}


void loop() {
  Blynk.run();
  timer.run();
}

void readInput() {
  if (digitalRead(button) == ON) {
    // btn1State is used to avoid sequential toggles
    if (changed == OFF) {
      // Toggle LED state
      ledState = !ledState;
      Blynk.virtualWrite(V0, ledState);
    }
    changed = ON;
  } else {
    changed = OFF;
  }
}

@khachan89 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.

Pete.

I did it. thank for your guide.

Writing data to the virtual pin using Blynk.virtualWrite() doesn’t trigger the corresponding BLYNK_WRITE() function. If it did then you could easily create an endless loop.

You don’t need the Blynk server to tell you what the current value of V0 is anyway, you’ve just written that value to the virtual pin, so you know it anyway.

Pete.