You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Hello all, I have an ESP32 with an SD card module. I want to read data from the SD card and save it in variables. However, after the ESP reads the data, it panics.
this is the code:
`
#include <SPI.h>
#include <SD.h>
#include "FS.h"
String DataTemp;
String Parametro;
short i;
String AllData[7];
int Pointer = 0;
int count = 0;
File file = fs.open(path);
if(!file){
Serial.println("Failed to open file for reading");
return;
}
Serial.print("Read from file: ");
while(file.available()){
char c = file.read();
if (isPrintable(c)) { //
DataTemp.concat(c);
}
else if (c == '\n') { // End of line
Parametro = DataTemp; //
DataTemp = ""; // Reset to null ready to read the next line
Serial.print("The parameter is: ");
Serial.println(Parametro); // Show us the valu
AllData[Pointer] = Parametro;
Pointer++;
}
}
for (count=0;count<5;count++) {
Serial.println(AllData[count]);
delay(100);
}
delay(100);
file.close();
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
"Hello all, I have an ESP32 with an SD card module. I want to read data from the SD card and save it in variables. However, after the ESP reads the data, it panics.
this is the code:
`
#include <SPI.h>
#include <SD.h>
#include "FS.h"
String DataTemp;
String Parametro;
short i;
String AllData[7];
int Pointer = 0;
int count = 0;
void readFile(fs::FS &fs, const char * path){
Serial.printf("Reading file: %s\n", path);
}
void setup() {
Serial.begin(115200);
delay(10);
}
void loop() {
readFile(SD,"/data.txt");
delay(20000);
}
`
Can anyone help me with this problem?, and how I can save data from one line in this form (0,69.50,20.10) in variables x=0 y=69.50 z=20.10 ?
Beta Was this translation helpful? Give feedback.
All reactions