Hi, I don't know if this is already solved in another post, but I didn't find it.
The problem is that my Micro SD module iniciates and reads some ".txt" files which are called "mapa___"
but then when I try to open another file with the name structure "mapasup___" it doesn't open.
The "___" is the place reserved for a number.
#include <SD.h>
File myFile;
String copy;
const String txt_s=".txt";
const String mapa_s="mapa";
const String mapasup_s="mapasup";
int n_mapa=22;
float mapa[384];
float mapasup[384];
int i;
void setup(){
Serial.begin(9600);
if(!SD.begin(7)){
while(1);
}
pintar_mapa();
}
void loop(){
}
void pintar_mapa(){
//COPY MAP
myFile=SD.open(mapa_s+n_mapa+txt_s);
Serial.println(myFile);
if(myFile){
//SOME MORE CODE
myFile.close();
}
myFile=SD.open(mapasup_s+n_mapa+txt_s);
Serial.println(myFile);
if(myFile){
//THE SAME MORE CODE
myFile.close();
}
}
So if I open the Serial the answer is myFile=1 for the first part and myFile=0 for the second try.
If you need more information ask me pls. Thank you for reading!