Add WiFiManager
This commit is contained in:
parent
37736012d4
commit
a6622975e3
11
src/main.cpp
11
src/main.cpp
|
@ -3,6 +3,7 @@
|
||||||
#include <Arduino_JSON.h>
|
#include <Arduino_JSON.h>
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
|
#include <ESPAsyncWiFiManager.h>
|
||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <pinout.h>
|
#include <pinout.h>
|
||||||
|
@ -15,6 +16,8 @@ Adafruit_MAX31855 thermocoupleB(CS_B);
|
||||||
|
|
||||||
AsyncWebServer server(80);
|
AsyncWebServer server(80);
|
||||||
AsyncWebSocket ws("/ws");
|
AsyncWebSocket ws("/ws");
|
||||||
|
DNSServer dns;
|
||||||
|
AsyncWiFiManager wm(&server, &dns);
|
||||||
|
|
||||||
JSONVar readings;
|
JSONVar readings;
|
||||||
|
|
||||||
|
@ -109,13 +112,7 @@ void setup() {
|
||||||
}
|
}
|
||||||
WiFi.mode(WIFI_AP_STA);
|
WiFi.mode(WIFI_AP_STA);
|
||||||
Serial.printf("wifi init\n");
|
Serial.printf("wifi init\n");
|
||||||
WiFi.begin("hackerspace.gr", "hsgrwifi");
|
wm.autoConnect("therminator");
|
||||||
Serial.printf("connecting");
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
|
||||||
Serial.printf(".");
|
|
||||||
delay(500);
|
|
||||||
}
|
|
||||||
Serial.printf(".\n");
|
|
||||||
Serial.printf("connected! ip addr: ");
|
Serial.printf("connected! ip addr: ");
|
||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue