Blynk.run();

I use the watchdog timer to wake up my mega2560 board every eight second. Then I start the ESP8266 (by powering it up via a FET). I send a value to V0 and then go to sleep.

But it sometimes got stuck at the blynk.run(); for a very long time (seconds).

Any work around for this?

During Blynk.run() (correct me if I’m wrong, Blynkers) is when the library communicates with the Blynk servers. If your module is going to sleep it is possible that Blynk.run() is having to perform some lengthy setup process as it re-connects (DNS resolution perhaps?). Calling Blynk.run() more frequently will alleviate this, but you’ll have to trade that off against your project’s requirements.

BTW how did you determine that Blynk.run() is taking so long?

I did that by a serial print before and serial print after.

You could flash Blynk onto the ESP8266 and use I2C/UART from Mega to ESP + Interrupts to synchronize.

2 Likes