| 123456789101112131415161718192021222324252627282930313233 |
- #include <WiFi.h>
- #define NETWORK "Guest WiFi Signal"
- #define PASSWORD "something easy"
- #define HOSTNAME "outdoor-weather-station"
- void connectWifi() {
- WiFi.begin(NETWORK, PASSWORD);
- debug("Connecting to wifi ..");
- while (WiFi.status() != WL_CONNECTED) {
- debug('.');
- showProgress(PROGRESS_BLUE);
- delay(500);
- }
- debugln();
- debugln("Connected!");
- debuglog("IP: ", WiFi.localIP());
- debuglog("Strength: ", WiFi.RSSI());
- debuglog("DNS: ", WiFi.dnsIP());
- debuglog("Gateway: ", WiFi.gatewayIP());
- }
- void initWifi() {
- WiFi.mode(WIFI_STA);
- // Set the hostname
- WiFi.setHostname(HOSTNAME);
- connectWifi();
- }
|