I am going down a bit of a rabbit hole but as far as I can tell the LittleFS module has been included in arduino-esp32
It seems that is the newer version of this.
So it looks like it should be in my Arduino as long as I have ESP32 installed which I do, however, when I try to create a ./data folder with an index.html and the following in my .ino
#include <FS.h>
#include <LittleFS.h>
#include <WiFi.h>
#include <WebServer.h>
WebServer server(80);
void setup() {
Serial.begin(115200);
delay(1000); // Give time for the serial monitor to start
if(!LittleFS.begin(true)) {
Serial.println("LittleFS Mount Failed");
return;
}
WiFi.begin("BroadviewOnline", "BuckeyeGuy");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
server.on("/", HTTP_GET, []() {
Serial.println("Page requested: /");
File file = LittleFS.open("/index.html", "r");
if (!file) {
Serial.println("Failed to open file");
server.send(500, "text/plain", "Internal Server Error");
return;
}
size_t fileSize = file.size();
Serial.print("File size: ");
Serial.println(fileSize);
if (fileSize > 0) {
server.streamFile(file, "text/html");
} else {
Serial.println("File is empty");
server.send(500, "text/plain", "Internal Server Error");
}
file.close();
});
server.begin();
Serial.println("HTTP server started");
}
void loop() {
server.handleClient();
delay(10); // Yield to reset the watchdog timer
}
I get an empty response at the IP like the file never go uploaded. What am I missing?