Just an explanation for a detail that I did not find an explanation for:
I saw that someone uses Blynk.run () in the Loop while others use Blynk.connect () in Setup.
In the documentation I did not find a clear explanation of the difference in practical terms of these two calls. All my sketches work properly without Blynk.connect () in the setup but with Blynk.run () in the Loop. Thanks to those who give me this info.
do not understand me wrong âŚ
itâs all 100% written but I do not understand.
favorite so I think âalternativeâ?
I do not believe. From what I understand Blynk.connect() starts the connection to the server and returns the connection status (true if connected, false if disconnected). At this point Blynk.run() could also be not inserted in the loop? And viceversa? Does Blynk.run() even manage to start the connection to the server as well as manage all the processes between devices, servers and apps? It would seem so since I have never used Blynk.connect() but only Blynk.run().
But I do believe you are using Blynk.begin(), which Iâm not.
So we do have:
Blynk.config () - for setting the connection details,
Blynk.connect() - for establishing connection,
Blynk.connected() - for checking the connection to server
Blynk.run() - for managing Blynk âstuffâ. If Blynk.connect WAS NOT called earlier, it tries to connect as well.
Blynk.begin() - blocking function which does the following: Establishes network connection, sets up Blynk connection details, and TRIES to connect to Blynk server⌠Till the end of the world, if it canât reach the server.
Blynk.run() is an essential housekeeping command that keeps the background library ârunningâ.
Blynk.connect() is an optional command that, used in conjunction with other connection management commands, can allow purposeful disconnection and reconnection to the server, along with semi or automatic reconnection routines to handle outside network interruptions.
Thanks Gunner (and to everyone else) as usual extremely exhaustive.
The difference that you have clearly illustrated is not shown clearly in the documentation and it would be a good idea to add these few lines of explanation.
So what is the consensus of the question?
Have been trying to find out if calling Blynk.run() is sufficient to handle server disconnect?
Does Blynk.run() also connect/reconnect to the server or is it only managing housekeeping? I have not been able to verify one or the other and the documentation is not clear on this point.
Blynk.run() - for managing Blynk âstuffâ. If Blynk.connect WAS NOT called earlier, it tries to connect as well.
So if I use Blynk.begin(auth, ssid, pass); in my setup, would Blynk.run() be enough in a reconnect function or should I use Blynk.connect():?
Blynk.run() is an essential housekeeping command that keeps the background library ârunningâ.
Why reopen an old topic for this again, it was also recently referenced in another current topic⌠Does one need to know the formula for gasoline to know that you need a constant flow of it to run a car?
We need to read ALL the documentation, often repeatedly and even after many years of using Blynk As well as compare differing situations and commands to understand the hows, whys and whens of many commands.
This leads to learning experiential information that may be beyond what is in the Docs⌠Good Documentation takes time and Blynk is constantly in development, so probably not a lot of time for both, thus hands on learning is a necessity.
Blynk.run() must be called as frequently as possible as it is the heart of the background Blynk process in your sketch.
That is basically it.
But, yes, it will try to connect if the server is not already connected. This is mentioned in the docs in reference to Blynk.config(). But there are many other situations in which you would need to use a different command like Blynk.connect() as you may purposely NOT have Blynk.run() active as you may be disconnected while still wanting running code - C++ Blynk - Code Examples for Basic Tasks (Work in Progress)
If you need further info, please create a new topic with details of your specific code and/or needs of assistance in your project. Thank you.