I’ve looking in vary topics but I’ve don’t found the solution to my problem.
My project is very simple : I would like to drive (Virtual V3) a led (or a relais) with Esp8266_07 but in the same time I would like the status of the physical pin (5) connected to the led (Virtual V2). Also I would like to receive the voltage reading of my Esp8266 (Virtual V1).
Following the best working sketch; the problem is that sometimes the led status on the app it is not synchronized with the physical status of the pin. I’ve tried syncAll and synVirtual but it seems worse.
May someone give me some suggestion ?
thank you in advance
First, I would recommend changing your voltage read to a timer with these changes/additions to your code:
SimpleTimer timerVCC; // Setup voltage reading timer with legible name
void setup() {
// Add this to your setup void
timerVCC.setInterval(5000L, espVCC); // Run voltage timer every 5 seconds.
}
void loop()
{
// Add this to your loop void
timertimerVCC.run();
}
// And change existing BLYNK_READ(V1) function to this void function.
void espVCC()
{
Blynk.virtualWrite(V1, ESP.getVcc()); // V1 is a display widget of some sort.
}
thank you for your help. I’ve modified the sketch but it seems that the timer interfers with BLYNK_WRITE : I can have readings of espVCC but if I push on the button (V3) on the app three is no action on the physical pin (led connected to pin 5 on ESP8266_07).
Conversely, with the sketch I’ve posted I can drive the led but sometimes the espVCC reading on the app stops.
It is either their timer or one well tested with Blynk… but implementation can make a difference. As I said, it was just an untested quick n dirty example… sorry
Change the button widget to switch mode and try again. I find there can be cases for a bounce effect (most likely due to timing in the link?). flags and additional code arrangements can resolve that, but I just kept it simple as for an on/off switch.