Question about Blynk.syncAll() & Blynk_connected()

Hi,

I am using the following code from the docs in my project:

BLYNK_CONNECTED() {
  if (isFirstConnect) {
    Blynk.syncAll();
  }
}

Is there a way to know when the synchronization has finished? At the moment my loop seems to start before synchronization has finished but i would like that it waits for it. Is there a way to achieve this?

Kind regards,
Tom

1 Like

This is outdated code.

Use this method.

void setup(){
  // ...
  // Place directly after Blynk.begin() / or other connection to Blynk.
  Blynk.syncAll();
}

This will perform once on Hardware boot.
As long as your hardware is powered, you should not need to sync again.

Also the sync is instant. It will call ALL virtual pins that are in use in your project.
This can vary from a few to hundreds depending on the project.

You should really only sync the virtual pins that you need to sync by using the following function.

Blynk.syncVirtual(V1, V2, V5); // etc

This will just call the corrisponding BLYNK_WRITE function you have setup for each of the pins. So the “confirmation” is seeing the correct data synced in your Serial Monitor or other custom coded confirmation.

thank you very much for your help! :slight_smile:

1 Like

thank you mister…that is my problem