Hello Every one
I have an D1 mini wemos ESP8266 Device connected to a Micro Sd card reading adapter. On the SD card
these a text file named wifi.txt that has a string with wifi username and password separated by a comma
I.E MYUSERNAME , MYPASSWORD
How can I read the file and save the two strings as separate strings in my application? So the username = MYUSERNAME password =MYPASSWORD using the comma separator as a string splitter.
void Load_SD_Card(){
// re-open the file for reading:
myFile = SD.open("TEST.TXT");
if (myFile) {
Serial.println("TEST.TXT");
// read from the file until there's nothing else in it:
while (myFile.available()) {
char data= myFile.read();
//Would like to add parsing code here to get the two separate strings for username and password.
I tried for loops of the char but not successful.
Serial.write(data);
}
///Serial.write(myFile.read());
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}I
What would be the best way to do this, please?
Thank you.