Problem with multiple virtualWrite() calls in sequence

Coding for deep sleep is very different to regular Blynk coding - where the void loop needs to be kept clean. With deep sleep, the opposite is true, you want the void loop to execute once, so you put everything in there.

I have no experience of coding ESP32s for deep sleep, but i think the general principals should be the same.

Your code contains no Blynk.run(); commands, which in my experience are needed to get most Blynk functions to work correctly. You’re also trying to use Blynk.connect when I suspect that you should be using Blynk.connected()```

Also, using Blynk.begin, which is a blocking function, isn’t good for battery powered devices as a failure to connect to Wi-Fi or Blynk will result in the device continually trying to connect until it either succeeds or the batteries are flat.
It’s better to use do your own Wi-Fi connection management then use Blynk.config and Blynk.connect.

Here’s a bit of code that I contributed to in the earlier stages when it was running on an ESP8266, but was then ported over to ESP32 by @christophebl and he reports that it’s working well for him…

Pete.

1 Like