Hey all, so am working on a Blynk script to run on the Sonoff Home Automation Switches from ITead and had a couple of questions.
Am I right in saying that if my wireless drops out for some reason (eg, Wireless AP is reset) then
Blynk.run();
Will reconnect to the wireless for me? And that also handles the initial connection?
Does it “block” the rest of the sketch waiting for the wireless to connect?
The device should also be checking a physical switch state which should operate whether the wireless is connected or not. (Don’t want to not be able to turn my lights on/off if my wifi goes down for some reason).
If so, would something like this work in the Loop of my sketch
bool isconnected = Blynk.connected();
if (isconnected) {
Blynk.run();
} else {
Blynk.connect(5);
}
I’m running a local blynk server, so i’m hoping that 5 seconds should be enough. I don’t want to delay my sketch any further than that.
Or is there a better way to do what I want to do?