Reading value of a Pin in void setup ( ) - how to do it?

Simple question here. Is there a way I can simply read the value of a virtual pin in the void setup ( ) code set. Background: I want to use virtual pin to save state information as I put the wemos to deepsleep at the end of the setup function.

You can call Blynk.syncVirtual(V0). And expect call of BLYNK_WRITE(V0).

thanks Dmitriy.
The issue is I put the wemos to deep sleep at end of void setup () so I assume if I do as per your suggestion BLYNK_WRITE(V0) will never get called … is this correct assumption ?

BTW: as a matter of interest I don’t understand why there isn’t a simple command to read the value of a virtualpin – what is logic behind not having it ?

@mars look up sync in the docs, it will “recover” variables after deep sleep.

Reading virtual pins is done with the aptly named BLYNK_WRITE() function.

thanks for your help @Dmitriy @Costas - yep got it working but a Blynk.virtualRead would be nice to have I would have thought :slight_smile:

BTW: i find the support your and others provide on Blynk Community outstanding ! and in my mind is pivotal to the success of Blynk

1 Like

This is because Blynk library is asynchronous. syncVirtual(V0) is virtualRead indeed. This is just asynchronous paradigm. You need to change your mind set a bit :slight_smile:.