/ESP32_WebSocket_SPIFFS_Server_Example

Simultaneously control and view status of an RGB LED from multiple web browsers.

Primary LanguageC++MIT LicenseMIT

ESP32_WebSocket_SPIFFS_Server_Example

  • From mutiple web browsers control and see status of an RGB LED. 20220612_123334 Screenshot_20220612-124102_Firefox

Original Source of Example Code (Retrieved April 2022):

  1. https://microcontrollerslab.com/esp32-web-server-spi-flash-file-system-spiffs/
  2. https://github.com/me-no-dev/ESPAsyncWebServer

Changes:

  1. Example code extended to show 3 buttons, to control 3 outputs. Intended to connect to an RGB LED.
  2. LED colors help with WiFi connection diagnosis, instead of the LED defaulting to being off.
  3. Remove anonymous function from server.on(), as I feel it is an inappropriate use that is confusing.
  4. Print the local IP address to Serial every 10 seconds for later on Serial Monitor connections.
  5. Add Arduino_secrets.h file.

Instructions:

  1. Use this Board: ESP32 Dev Module
  • Partition Scheme: Default 4MB with spiffs
  • Other defaults are OK
  1. Actual board used for testing: Clone of DOIT ESP32 DEVKIT V1

Tutorial on how to load SPI Flash File System (SPIFFS):

  1. https://microcontrollerslab.com/install-esp32-filesystem-uploader-in-arduino-ide-spiffs/
  2. https://github.com/etherfi/arduino-esp32fs-plugin-esp32s2

Some errors corrected from the example code:

  1. The HTML header was fixed. I think it was a copy-paste error.
  2. The function template_processor() needs to return a default value.
  3. The SPIFFS filenames need to match lowercase/uppercase exactly.