So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Marfun
#71967 Hey!
I try to add a five-second delay before the HelloServer script connects to my Wifi, but whatever I do it does not work, either there's a problem to compile or the ESP does not connect at all. Can anyone kick me in the right direction?


Code: Select all#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

const char* ssid = "WiFi";
const char* password = "Password";

    delay(5000): // here somewhere

ESP8266WebServer server(80);

void handleRoot() {
  digitalWrite(led, 1);
  server.send(200, "text/plain", "hello from esp8266!");
  digitalWrite(led, 0);
}
User avatar
By Narfel
#72104 If you use atom/platformio the time to reconnect the terminal session after a firmware upload is pretty close to 5seconds. That's why a lot of sketches stick something like
Code: Select all       
for(uint8_t t = 5; t > 0; t--)
        {
                Serial.printf("Starting in %d...\r\n", t);
                Serial.flush();
                delay(1000);
        }

in the setup()) to see the startup serial output. Not sure if that is the intention here, though.