I think it is a blocking command, until the timeout or connection is made, whichever comes first… so the quicker the timeout, the quicker the rest of your program runs if there is no initial connection.
Probably Blynk.connect(15) as I don’t think it counts in ms
Please Mr. @vshymanskyy answer me the questions both if the Blynk.connect() is a blocking type function ( as it seems ) and in case of Blynk.connect(timeout) what number should be the timeout value for let say timeout of 15 seconds.
Thanks!
Well, surely I’m just another user,but simply because Blynk lib is open source (happily!!) there is one, very simple way to verify all doubts. Here is excerpt from Blynk library:
in BlynkApi.h:
/**
* Connects to the server.
* Blocks until connected or timeout happens.
* May take less or more then timeout value.
*
* @param timeout Connection timeout
* @returns True if connected to the server
*/
bool connect(unsigned long timeout = BLYNK_TIMEOUT_MS*3);
and in BlynkProtocol.h:
bool connect(uint32_t timeout = BLYNK_TIMEOUT_MS*3) {
conn.disconnect();
state = CONNECTING;
millis_time_t started = BlynkMillis();
while ((state != CONNECTED) &&
(BlynkMillis() - started < timeout))
{
run();
}
return state == CONNECTED;
}
Now, a quick look will bring an answer to both your questions @mikekgr:
yes, it is a blocking function (until it timeouts or connects)