From 71eaa48cc3d2a8862cfd7fd2ebab76b3083c481f Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Wed, 7 Mar 2018 14:23:51 +0100 Subject: [PATCH] WiFiMulti --- src/main.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9ffe7d4..0121a17 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -19,8 +20,8 @@ #include const char* server = "ingress.opensensemap.org"; -const char* ssid = "Freifunk"; -const char* password = ""; +//const char* ssid = "Freifunk"; +//const char* password = ""; constexpr unsigned int postingInterval = 60000; //Uploadintervall in Millisekunden @@ -61,6 +62,8 @@ static constexpr unsigned long logging_period_ms = 60000; ADC_MODE(ADC_VCC); +ESP8266WiFiMulti wifiMulti; + Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085); DHT dht(DHT22_PIN, DHTTYPE); SDS011 sds; @@ -69,10 +72,12 @@ unsigned long geiger_previousMillis; void ICACHE_FLASH_ATTR sendValues() { WiFi.forceSleepWake(); - WiFi.begin(ssid, password); - Serial.print("Connecting to wifi"); + WiFi.mode(WIFI_STA); + wifiMulti.addAP("nether.net", "password1"); + wifiMulti.addAP("LNet", "password2"); + wifiMulti.addAP("Freifunk", ""); int tries = 0; - while (WiFi.status() != WL_CONNECTED) { + while (wifiMulti.run() != WL_CONNECTED) { tries++; Serial.print("."); if (tries > 20) {