I am trying to use the SD library to read from a file on my card and use the contents. I copied a 160KB file to the card and opened it with the SD library, but the available() function says there are only 31854 available bytes.
Here is the code that tells me that:
#include <SD.h>
File data;
void setup()
{
SD.begin(10);
Serial.begin(9600);
data = SD.open("file.txt");
if (data)
{
Serial.println(data.available());
}
}
void loop()
{
}
If I use the read() function in a loop until there are no more bytes available, the program does only read 31854 bytes. How do I access all the data in my file?