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) {