UPDATE I've found the issue. The ethernet board I'm using for the SD card reader is not receiving enough power, because I'm also powering an LED strip.
I'm trying to build a project and I need to load data from an SD card but reading from the SD card seems to fail part way through the file.
It fails after reading 54,182 bytes, I was thinking maybe it's because of some file buffer or something.
I am using an Arduino Uno with the Ethernet board (temporarily, just for its SD card slot)
Here's a simplified version of my program (where it's breaking)
...
while (csvFile.available()) {
char b = csvFile.read(); // read 1 byte
Serial.print(b); // for debugging
delay(1); // for debugging
if ((int)b < 0) {
Serial.println("found negative value: " + String((int)b)); // for debugging
csvFile.close();
break;
[tt] }
[/tt]
[tt] ...
}
[/tt]
[tt]...
[/tt]
Do I need to do anything to make sure the stream has bytes available to be read? I will be reading the file as fast as I can eventually, but it fails even going slow (waiting 1 ms after each byte read)