I have a .txt file loaded into the SD card which contains:
SampleTime: 100
SampleInterval : 1000
Phone: 91987654331
I am reading this using the readStringUntil(':'); in Arduino IDE but it reads the whole content together, but I want to split the string and integer and store it in different variables. I want to know how I can split it easily and store it in different variables. Below is my code:
void setup() {
Serial.begin(9600);
if (SDfound == 0) {
if (!SD.begin(4)) {
Serial.print("The SD card cannot be found");
while(1);
}
}
SDfound = 1;
printFile = SD.open("consta.txt");
if (!printFile) {
Serial.print("The text file cannot be opened");
while(1);
}
while (printFile.available()) {
buffer = printFile.readStringUntil(':');
Serial.println(buffer); //Printing for debugging purpose
//do some action here
}