After the router is powered off and restarted, how does eap8266 automatically connect to the wifi and blynk servers?
By reading the documentation and searching the forum for solutions
I have encountered the same problem. After the router is powered off and restarted, how does eap8266 automatically connect to the wifi and blynk servers? Please help me, thank you very much!
And since you already have a topic about this, please do not post the same question in other, older, topics. Thanks.
PS I moved your post back here.
Thanks a lot, I tried your code, but it doesnât work. Is there a problem here? " timer.setTimeout(30000L, { . . .
Mainly used these codesďź
-
- List item
#define BLYNK_PRINT Serial // This prints to Serial Monitor
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = âxxxxxxxxxxâ;
char ssid[] = âxxxxxxxxxxâ;
char pass[] = âxxxxxxxxxxâ;
//char server[] = âxxx.xxx.xxx.xxxâ; // IP for Local Cloud Server
char server[] = âblynk-cloud.comâ; // URL for Blynk Cloud Server
int port = 8080;
int ReCnctFlag; // Reconnection Flag
int ReCnctCount = 0; // Reconnection counter
BlynkTimer timer;
void setup() {
Serial.begin(115200);
pinMode(2, OUTPUT);
WiFi.begin(ssid, pass); // Non-blocking if no WiFi available
Blynk.config(auth, server, port);
Blynk.connect();
}
BLYNK_CONNECTED() {
Serial.println(âCconnectedâ);
ReCnctCount = 0;
}
void loop() {
timer.run();
if (Blynk.connected()) { // If connected run as normal
Blynk.run();
} else if (ReCnctFlag == 0) { // If NOT connected and not already trying to reconnect, set timer to try to reconnect in 30 seconds
ReCnctFlag = 1; // Set reconnection Flag
Serial.println(âStarting reconnection timer in 30 secondsâŚâ);
timer.setTimeout(30000L, { // Lambda Reconnection Timer Function
ReCnctFlag = 0; // Reset reconnection Flag
ReCnctCount++; // Increment reconnection Counter
Serial.print(âAttempting reconnection #â);
Serial.println(ReCnctCount);
Blynk.connect(); // Try to reconnect to the server
}); // END Timer Function
}
}
Why are you reposting the same code I gave you the link for?? And posting it UNformatted as well
I tried your code, but it doesnât work.
hello , I used their code, but if the channels are active during a disconnection of the network, they are still active, ideally disconnecting the channel from the relay with the network