@vinifersil Welcome to the Blynk Forum.
First, I fixed your posted code formatting… please use this method, as required in the pinned topic that you should have read at the beginning: Welcome to Blynk Community!
That’s not the issue… Anything running in the
void loop() runs constantly… and if it takes too long to loop, it delays the
Blynk.run() housekeeping and crashes your connection… thus the requirement of timers and timed functions.
There is entire sections (links at top of this page) one of which is called Help Center that has answers to many common questions and issues like you are running into
Here is a brief excerpt from one:
Avoiding the void
️ ️ VERY IMPORTANT: You can’t send sensor data in your
– Because Blynk sends data over the Internet, and when you put something into void loop(), your microcontroller will execute it gazillion number of times. Which means that Blynk Cloud will be flooded with gazillion messages from your hardware.
And when Blynk Cloud notices that, it automatically ︎ cuts your connection. Sorry…
– OK, what should I do then?
– Send sensor data in intervals!
Using timers to send sensor data in intervals
There are lots of ways to send data in intervals, but here is a simple one. We recommend using a BlynkTimer for that. It’s included in Blynk Library Package, so if you installed Library correctly, you are all set.