I have a very large sketch that integrates just about every aspect of an Arduino (mega2560). Everything is working great except I have come across an interesting thing.
My sketch involves continuous communications over UDP to another device. If communications is broken for more than 300mS the other device drops off.
My sketch uses the SD card for lots of data storage from another network device. everything works ok except for....
When I open a file to write data the first 'write' takes 3 seconds!
PREAMBLE as per usual.... then tempfile = SD.open(CASPARCGDOC, FILE_WRITE); tempfile.seek(0); Serial3.println(millis()); // test only to display timer start tempfile.write(byte (0)); // write anything.... Serial3.println(millis()); // test only to display timer end
Here I have put a display in there to show how long it takes to write a single byte - it ends up as ~3000 mS. After that all other bytes are written almost instantaneously!
Of course after this my other code times out and has to be reconnected.
Any one else seen the above behavior?