12 years, 5 months ago.

SDFileSystem Fatal errors

If no SD card is connected, the SDFileSystem fopen() function will produce a fatal error (or hang the program). I tried inserting an sd.disk_initialize() function before the fopen() and this prevents the program from hanging. However, attempting to run this same code a second time, hangs the program. Any suggestions for a robust file I/O scheme?

FILE *fp = NULL;

if (sd.disk_initialize()) fp = fopen(fname, "w");

write to file here.

if (fp) fclose(fp);

Be the first to answer this question.