Skip to content

Instantly share code, notes, and snippets.

View pim-borst's full-sized avatar

Pim Borst pim-borst

  • Netherlands
View GitHub Profile
@pim-borst
pim-borst / AsyncSDServer.ino
Last active June 10, 2023 03:09
Serve files from an SD-card using Me No Dev's async webserver for the ESP8266.
/*
* Example how to serve files from an SD-card using Me No Dev's async webserver for the ESP8266.
* See https://github.com/me-no-dev/ESPAsyncWebServer
*
* Basically I copied the code for serving static files from SPIFFS and modified it for the SD library.
* To resolve conflicts between SPIFFS and SD File classes I had to include the sd namespace in SD.h and SD.cpp in packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src.
* So in SD.h put "namespace sd { ... }; using namespace sd;" around everything excluding the # preprocessor directives.
* And in SD.cpp put "namespace sd { ... };" around everything excluding the # preprocessor directives.
*
* Also, don't forget to fill in your WiFi SSID and password and put an index.htm file on your SD card.