BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

How to run a function after all Blynk virtual write

I am writing to a eeprom so how can I commit the chanages after all the virtual writes ??

It’s impossible to answer your question without further information about your code and what you are trying to achieve - as well as the type of hardware you are using.

EEPROM memory has a very limited life - it’s usually said to be good for around 100,000 read/write operations. Because of this, it’s important to only write data to the EEPROM if it’s changed.

If you’re using an ESP8266 or ESP32 based device then you have much better alternatives to EEPROM. SPIFFS was introduced as a better storage system, and that has now been replaced by LittleFS.

Pete.

I am using Nodemcu and what I want is to call a function after all the BLYNK_WRITE functions are ran and that function will write to eeprom

Animesh

Then do exactly that, add a write-to-eeprom(); command as the last line of your BLYNK_WRITE(vPin) callback.

But, you should be using LittleFS with your hardware.

Pete.

I want to commit it at the last after the all BLYNK_WRITE runs like V1 V2 V3 V4 and commit them at once

I guess you could set a flag after each of the virtual writes has been completed, and execute your EEPROM write if all the flags are set when the final virtual write occurs.
It’s not really a Blynk related issue though, just a regular C++ coding exercise.

Pete.

Thank You