I have folder contain n txt file(files have numeric values) I need to read these files and save the file contains in array. How can I read the contents of the first file1 in the array and then clear the array ,and then read the second file2 in the same array and so on?
#include "SPIFFS.h"
void setup() {
Serial.begin(115200);
float *arr=(float*)malloc(1000*sizeof(float));
if (!SPIFFS.begin(true)) {
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
File root = SPIFFS.open("/");
File file = root.openNextFile();
while(file){
for(int i=0;i<1000;i++){
arr[i] = file.parseFloat();
Serial.println(arr[i]);}
//Serial.println(file.name());
//file = root.openNextFile();
}
}
void loop() {}