Arduino: load variables with values read from SD card I am having a bit of trouble loading values stored on an SD card and assigning them to variables within my program. I can achieve this as one big block of data, but would much prefer them to be saved to variables whilst in a loop or some other process.

My txt file has the following 6 ints &amp; floats values, which are displayed vertically in the file:

2
0.003200
312
1
0.720000
8

Each of these values I want assigned to variables data1,....2,3,4,5,6. Unfortunately, the code I use below will never achieve this, but I am clueless as to any theory to solve this problem. Thanks in advance.

myFile = SD.open("test.txt", FILE_READ);
    if (myFile) {
    while (myFile.available()) {
        data = myFile.read();
    }
myFile.close();
}
else {
    Serial.println("Read Error");
}
File implements Stream just like Serial. so you can use parseInt and parseFloat 

int n = File.parseInt();
float x = File.parseFloat();
Serial.println(n);
Serial.println(x, 6);