wifi_testing_konek/wifi_testing_konek.ino0000755000000000000000000000261314013077641016227 0ustar // CheckServer.ino by Costas 17/7/2016 #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include #include #include SimpleTimer timer; char auth[] = "xxxxxxxxxxxx"; char ssid[] = "kebunku"; char pass[] = "xxxxxxxxxxxx"; bool Connected2Blynk = false; void setup() { Serial.begin(115200); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); Blynk.config(auth); // in place of Blynk.begin(auth, ssid, pass); Blynk.connect(3333); // timeout set to 10 seconds and then continue without Blynk while (Blynk.connect() == false) { // Wait until connected } Serial.println("Connected to Blynk server"); timer.setInterval(11000L, CheckConnection); // check if still connected every 11 seconds } void CheckConnection(){ Connected2Blynk = Blynk.connected(); if(!Connected2Blynk){ Serial.println("Not connected to Blynk server"); Blynk.connect(3333); // timeout set to 10 seconds and then continue without Blynk } else{ Serial.println("Connected to Blynk server"); } } void loop() { if(Connected2Blynk){ Blynk.run(); } timer.run(); }