Ymodem ESP32 1.0.0
Loading...
Searching...
No Matches
readSpiffs.cpp File Reference

Example code to read files from SPIFFS. More...

#include <Arduino.h>
#include <SPIFFS.h>
+ Include dependency graph for readSpiffs.cpp:

Go to the source code of this file.

Macros

#define MAX_DEBUG
 
#define DELETE_FILES
 

Functions

void setup ()
 Setup function for initializing Serial communication and SPIFFS.
 
void loop ()
 Main loop function.
 

Detailed Description

Example code to read files from SPIFFS.

Author
Miguel Ferrer (mferr.nosp@m.er@i.nosp@m.nbiot.nosp@m..es)
Version
0.1
Date
2025-01-24

This code is an example of how to read files from the SPIFFS filesystem using the ESP32 SPIFFS library. It lists the files in SPIFFS, reads and displays the content of each file, and optionally deletes the files after reading.

This file is used to demonstrate the SPIFFS library functionality and how to interact with the filesystem on the ESP32. It can be used to check the contents transferred using the Ymodem protocol.

Definition in file readSpiffs.cpp.

Macro Definition Documentation

◆ DELETE_FILES

#define DELETE_FILES

Comment this line to keep the files after reading

Definition at line 24 of file readSpiffs.cpp.

◆ MAX_DEBUG

#define MAX_DEBUG

Comment this line to disable file content display

Definition at line 23 of file readSpiffs.cpp.

Function Documentation

◆ loop()

void loop ( )

Main loop function.

This function is intentionally left empty as no code is needed to be executed repeatedly for this operation.

Definition at line 115 of file readSpiffs.cpp.

◆ setup()

void setup ( )

Setup function for initializing Serial communication and SPIFFS.

This function performs the following tasks:

  1. Initializes Serial communication at a baud rate of 115200 for debugging purposes.
  2. Waits until the Serial is ready.
  3. Initializes the SPIFFS (SPI Flash File System).
  4. Lists all files present in the SPIFFS.
  5. Optionally reads and displays the content of each file if MAX_DEBUG is defined.
  6. Optionally deletes all files in the SPIFFS if DELETE_FILES is defined.
  7. Lists all files present in the SPIFFS after deletion if DELETE_FILES is defined.
Note
Ensure that the SPIFFS library is included and properly configured in the project.
Define MAX_DEBUG to enable reading and displaying file content.
Define DELETE_FILES to enable deletion of all files in the SPIFFS.

Definition at line 42 of file readSpiffs.cpp.