BLYNK
BLYNK.IO       📲 GETTING STARTED       đź“— DOCS       👉 SKETCH BUILDER

Need info about BLYNK_WRITE(VX)

Hi, i have trouble with my esp8266 using this function:

    BLYNK_WRITE(V9) {///Reset historic values
  if (param.asInt()) {
    flag_pulso_dinero = true;
    flag_borrado_historic = true;
  }
}

i would like to know what things you cant do inside a BLYNK_WRITE() functions. Because i suspect that watchdog timer appears and that is the reason it is rebooting. Thanks in advance

I assume you have set button to push mode🤔

Hi, it is set as push mode.
is there something that you cant do inside that type of function? is it possible to disable the watchdog in esp8266?
Thanks

There’s nothing wrong with what you’re doing in the example sketch.
I suspect that it’s something else you’re doing within your sketch, such as using blocking delays, functions which take too long to execute, or having a cluttered void loop.

Pete.

Hi pete, that function puts in true mode a flag, and then with that in the loop i use an if (flag) then do something, in this case put 0 in the EEPROM of the esp8266. I have 10 boards, with the same code and 4 of them have this issue, it reboots when i press the button.
What things you consider make a cluttered void loop?
I have pro plan with 100 devices, i couldnt find the support button to have a conversation with someone, how can i do it?
Thanks a lot

Anything more than Blynk.run() and timer.run()

Are you doing frequent EEPROM read/writes?
Any reason why you aren’t using SPIFFS or preferably LittleFS?
What aren’t you doing the necessary processing within the BLYNK_WRITE callback rather than doing the test within your void loop?

I don’t know. I have fee access to the Pro plan, but don’t get access to support.

Pete.

Pete, thanks for your fast replying

Yes, every time i press a button i do something in eeprom

I do not have much information about what that is, do you say that i can change eeprom function to any type of spiffs function? what is LittleFS?

I put a flag and then do thing in the void loop because when i put a lot of things inside a BLYNK_WRITE(), the watchdog appears and reboots my esp8266.

Another question, which is the problem of using others things more than this?

Thanks Pete

Each EEPROM address has an estimated life of around 100k read/write operations.
It’s very easy to kill your EEPROM.

LittleFS replaces SPIFFS, but basically uses the same syntax for most operations.
Both SPIFFS and LittleFS treat the ESP storage like a hard drive. They spread data across different locations, do CRC checks on the data, svoid using failing memory locations etc. This means that it’s almost impossible to kill your ESP’s memory using SPIFFS etc.

Edgent uses EEPROM to store the provisioned credentials, but these are accessed very infrequently. However, if you use EEPROM with Edgent you could overwrite the Edgent data.

The BLYNK_WRITE callback is probably the best place for these actions. But you need to solve the underlying cause of the watchdog issues, which isn’t the BLYNK_WRITE.

They usually lead to Blynk disconnections over time.

Pete.

Pete,

I have information about this. My type of usage is frequently but it is not inside any loop so it shouldnt be the problem. I really apreaciate the information you gave me of SPIFFS, i will try to use it. could you reccomend me some post? or tell me any function example so i can search info more accurately?

Also i will try to minimize void loop code but i have interruptions routines and some processing apart of BLYNK_WRITE() so i see that part almos imposible.
I really apreaciate your replies. Thanks a lot

There are lots of examples and tutorials on the internet, just do a quick search.

If you mean interrupt service routines then these don’t belong in the void loop.

The normal approach is to use timers for this.
Use a timer to call a function every x milliseconds to do what’s needed, whether that’s polling a switch status, checking if a certain condition has been met, reading a sensor etc.

The only time you’re likely to need to put anything in your void loop is if you are trying to do something like waiting for data to arrive on a serial stream or from something like an RFID reader.

Pete.

Hi Pete, i write/read EEPROM because i store variables, not files. With Little FS as you recommended, is this possible? or is it meant for files?
Thanks

A file can be a single piece of data (0/1) or a string of data.
You can have multiple files if you wish, representing multiple variables.

Personally, i tend to use a single file and use a separator character to identify the fields, which represent values that will go into variables.

Pete.