Hardware going offline way too often

i have my NodeMcu 8266 hardware running fine… almost…

i am getting lots of unexpected lost connections… or something…

Blynk.connected() is returning false…

looking thru the doc, it says do NOT put ANY Blynk. methods in loop(){}

but i see all kinds of code with Blynk.run(); in there… I have

void loop() {
  // only attempt Blynk-related functions when connected to Blynk
  if (Blynk.connected())

and timer is

 BlynkTimer timer;

so that leads me to believe that this is ALSO a Blynk. function in loop…

i have an timer event handler which sends (Blynk.virtualwrite()) the data…

yesterday the hardware was restarted about 8pm, and was reported offline by the app at 02:20am this morning,
but on the IDE serial console it showed still connected and writing happily… (5 virtualwrite()s (V1-V5) every 15 seconds)

what am I doing wrong, or how do I debug this…
(newbie, this is my 1st hardware and app construction)


sometimes if I close and reopen the mobile app it shows connected just fine… but had shown disconnected before that

If someone said don’t put your groceries in the engine compartment of your car… would you also assume the engine shouldn’t be there? :stuck_out_tongue_winking_eye:

What the docs are referring too is don’t put your main running code there, use the bare minimum needed in the void loop() stuff that needs to runs hundreds/thousands of times a second like Blynk.run() and timer.run() and perhaps even some simple connection checking routines, and use dedicated, timed, functions & loops for the rest of the code.

As for what is causing your disconnections… could literally be anything… bad code, bad power, bad WiFi, bad dog… we don’t know enough to even guess…

:rofl: that must be it!