im sorry i still find it hard to understand this code.
what if the value inside the SD card is "6.25". How can I read and get that value and store it in a float variable? van you give me a sample code of that?
Read each character of the float and put it into a char array. When the entire float has been read (see question above), terminate the char array with a zero and use the atof() function to convert the array to a float.
myFile = SD.open("Kup.txt");
if (myFile) {
Serial.println("Kup.txt:");
// read from the file until there's nothing else in it:
while (myFile.available()) {
String a = String(myFile.read());
Serial.print(a);
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
first what i am trying to do is read first the value and store it in a string variable then afterwards convert it into a float. This part Im having problems reading the value. The value written inside the SD card is 6.75. When I store it into a string. I dont seem to get the right values. What im getting is this: