content of myFile.println(); causes problems in writing to SD afterwards

Hi everyone,

right now I’m working on a temperature control that has the following procedure:

  1. read config file with attributes
  2. write header to csv file on SD (in setup)
  3. control temperature according to attributes from file (in loop)
  4. write temperature and other data to log file (in loop)

Hardware:

Arduino Uno
Datalogger Shield (SD + RTC)
LCD HD44780
MAX6675 Cold-Junction-Compensated K-Thermocouple-to-Digital Converter
switches and LED

Everything is working well but it seems as if the content of the header in the csv file prevents writing log data to the SD card afterwards.

for example (line 226):

myFile.println(“DATE;TIME;TEMP;HEAT;MIX;BLA1;BLA2”);

does work which means writing a data string to SD later on is succesfull (line 353). But the following doesn’t work and gives “error opening file”:

myFile.println(“DATE;TIME;TEMP;HEAT;MIX;BLA1;BLA2;BLA3”);

Are there any restrictions concerning the number of items I can write using println or the length of each individual item?

The complete code can be found in the attachment.

Datalogging_RTC.ino (10.3 KB)

It could be a Memory Issue.

Change all

print("SomeString")

to

print(F("SomeString"))

This should reduce the Memory Footprint.

(of course you need to do this also for println)

It really was a memory issue... I didn't think that the SRAM was that small. :-) I really do like this part of the memory section in the Learning area: "If you run out of SRAM, your program may fail in unexpected ways." And my program failed in unexpected ways. :-)

Re-writing the code with some F() in it helped. Thanks for your help!