I'm reading a large number of files off a SD card. They are named in ascending order from 0.txt to 3599.txt.
When the filename is between 0.txt - 99.txt, the program runs at a reasonable clip, processing a couple files a second. Once it gets to 100-999, it slows significantly, to maybe one a second. When the file name reaches 1000 or greater, the read slows to a crawl, updating maybe every 2 seconds. When the whole thing loops back to 0.txt, it picks up steam again.
I figure this has something to do with the clunky code I'm writing for iterating through the files. The relevant bits are below, any assistance would be great.
(I don't know if it matters, but I'm using Arduino 1.0 RC2)
#include <SD.h>
const int chipSelect = 4;
File dataFile;
int whatfile=0;String inString="";
String extension=".txt";void setup() {
Serial.begin(9600);
pinMode(10, OUTPUT);
SD.begin(chipSelect);
}void loop() {
String thefile;
if(whatfile==3600){
whatfile=0;
}thefile+=whatfile;
thefile+=extension;char fileName[12];
thefile.toCharArray(fileName, (thefile.length()+1));
dataFile = SD.open(fileName);
if (dataFile) {//process file and close it
dataFile.close();
}
Serial.println(fileName);
whatfile++;
}