You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
718 B
42 lines
718 B
#include <Arduino.h> |
|
|
|
#include <WiFi.h> |
|
#include <FS.h> |
|
#include <SPIFFS.h> |
|
#include <ESPAsyncWebServer.h> |
|
|
|
#include "wifi-credentials.h" |
|
|
|
AsyncWebServer server(80); |
|
|
|
void setup() |
|
{ |
|
Serial.begin(115200); |
|
|
|
if(!SPIFFS.begin(false)){ |
|
Serial.println("SPIFFS Mount Failed"); |
|
return; |
|
} |
|
|
|
// Connect to Wi-Fi |
|
WiFi.begin(wifi_ssid, wifi_password); |
|
while (WiFi.status() != WL_CONNECTED) |
|
{ |
|
delay(1000); |
|
Serial.println("Connecting to Wifi..."); |
|
} |
|
|
|
// Print ESP Local IP Address |
|
Serial.print("Wifi connected, ip="); |
|
Serial.println(WiFi.localIP()); |
|
|
|
server.serveStatic("/", SPIFFS, "/www/").setDefaultFile("index.html"); |
|
|
|
server.begin(); |
|
Serial.println("HTTP server started"); |
|
} |
|
|
|
void loop() |
|
{ |
|
delay(1000); |
|
}
|
|
|