#include #define NETWORK "Guest WiFi Signal" #define PASSWORD "something easy" #define HOSTNAME "outdoor-weather-station" void connectWifi() { WiFi.begin(NETWORK, PASSWORD); debugNoLn("Connecting to wifi .."); int64_t startTime = millis(); while (WiFi.status() != WL_CONNECTED) { if(millis() - startTime > WIFI_TIMEOUT_SECONDS * 1000) { debug("Could not connect to wifi."); ERR; } debugNoLn("."); showProgress(PROGRESS_BLUE); delay(500); } debug(""); debug("====="); debug("Connected!"); debugln("IP: ", WiFi.localIP()); debugln("Strength: ", WiFi.RSSI()); debugln("DNS: ", WiFi.dnsIP()); debugln("Gateway: ", WiFi.gatewayIP()); } void initWifi() { WiFi.mode(WIFI_STA); // Set the hostname WiFi.setHostname(HOSTNAME); connectWifi(); }