I have logged some data in my sdcard/FAT32 (format). I can read and display them on the serial monitor but additionally I want to use these data as float.
Here is my code:
byte index = 0;
Tfile = SD.open("DATALOG.TXT",FILE_READ);
while (Tfile.available()) {
x[index++] = Tfile.read();
x[index] = '\0'; // NULL terminate the array
}
Printing the data using:
Serial.print(fileContents);
I receive the following float values that are correct:
.63
15.63
16.60
16.60
16.60
16.60
etc
Now I want to work with values so i need to store them on a double index:
double dtemp[320];
for(index = 0, i=0; index < 320; index++, i++) {
dtemp[i] = fileContents[index];
Serial.println(dtemp[i]); }
but i receive fault values:
46.00
54.00
51.00
13.00
10.00
49.00
53.00
etc
Any comment is welcomed !
Thank you in advance !