Problems opening file for ofstream, when using SDFat

Hi. I’m working on a sensor logger program with a webserver built in. I managed to have the logging function when I wasn’t using these lines:

if (!card.init(SPI_FULL_SPEED, CS_SD)) Serial.println(“card.init failed!”);

if (!volume.init(&card)) Serial.println(“vol.init failed!”);

if (!root.openRoot(&volume)) Serial.println(“openRoot failed”);

in the setup to open the volume so the webserver part could access files. As soon as I put them in this part fails to open the file:, ios::out | ios::app);
if (!logfile.is_open()) Serial.println(“”);

See the full pastebin here:

The tutorial I’m basing the webserver part on is from here: Arduino Tutorials - Ethernet+SD

Any suggestions as to where I’m going wrong? Thanks,


What Arduino are you using? That list of include files is pretty long. I’d guess that you are out of SRAM. Look for the FreeMemory function.

It's an Arduino Uno, says 441 bytes free just before trying to open the file, same after. Thanks,