Skip to main content
1 of 3
Juraj
  • 18.3k
  • 4
  • 32
  • 50

to remove a file SD.remove("datalog.txt");

to start with an empty file

File file = FS.open("datalog.txt", O_READ | O_WRITE | O_CREAT);

SD library's FILE_WRITE is O_READ | O_WRITE | O_CREAT | O_APPEN so it would write at the end of the existing file.

Juraj
  • 18.3k
  • 4
  • 32
  • 50