system
March 25, 2013, 3:39pm
1
I have a simple routine that appends the data from one file to an Archive file.
Although the routine works fine. It is incredibly slow.
Almost a minute to Copy 10K
snippets::::
SPI.setClockDivider(4);
File Fin; // DATA FILE
File Fout; // Archive File
Fin= SD.open("DATA.S3D",FILE_READ);
if(Fin)
{
Fout= SD.open("ARCHIVE.S3D",FILE_WRITE);
while(Fin.available()) { Fout.write(Fin.read()); }
Fout.flush();
Fin.close();
Fout.close();
SD.remove("DATA.S3D");
}
Is there anything I can do to speed this up?
system
March 25, 2013, 5:24pm
2
Is there anything I can do to speed this up?
Of course. Read more than one character at a time. Write more than one character at a time.
system
March 25, 2013, 6:07pm
3
Is there a command for that.
The Sd Library only shows a SD.read that returns a byte.
I do see a writeln function but nothing like a readln.
system
March 25, 2013, 6:08pm
4
The Sd Library only shows a SD.read that returns a byte.
There are two versions of read() - one that returns a byte and one that populates an array. Look at the header file and source code, not the "documentation".
The write() method is similarly overloaded.