Micro SD card support

Hey, is there a library for the Photon that enables to log data on an SD card?
I’m using the “SparkFun Level Shifting microSD Breakout” so the wiring is quite straight forward, but I didn’t manage to compile any example provided in any library I found in the online Particle IDE on the Photon.

I looked at:
SD-CARD-LIBRARY-PHOTON-COMPAT
SDFAT
SD-CARD-LIBRARY

It looks like they are all build on top of each other , but none of those libraries seem to have examples that compile for the Photon.

Am I missing something?
Thanks in advance!

I recommend SDFAT. Build says it doesn’t compile because of the way the examples are organized. If you just use the TryMeFirst example, it will work just fine on the Photon. I have the SparkFun adapter and it works well with SDFAT.

3 Likes

That Worked great! thanks!!

1 Like

Did you get this impression by looking at the indicators under the lib name?
These darn indicators lie most the time - no idea why they ever got public after we reported them not helping at all for non-trivial libraries.

Hey, I actually tried to compile many of the examples and all of them kept throwing errors.

Also is there any way around the annoying error which says
"spark-datalogger.cpp:22:45: fatal error: <imported.library.name>.h: No such file or directory"
I’m getting this error each time I’m trying to import a sample file from a library, by clicking “USE THIS EXAMPLE”.
It’s like the IDE doesn’t know the library is attached to the example, so I have delete the library from the sample app and then re-import it. this is really annoying.

thanks!

That usually happens when the sample requires additional libraries.
You have to import them too.

When you can tell which lib you are using, since that sample doesn’t exist in the suggested SDFAT library.
I can look into that sample which other libs it calls for.

But I’d strongly recommend to use SDFAT, since that’s the most advanced, stable and permanently maintained lib.
The others are mainly there for legacy purposes.


If you are using sd-card-library-photon-compat.h you need to change the include statement from

#include "sd-card-library/sd-card-library-photon-compat.h"

to

#include "sd-card-library-photon-compat/sd-card-library-photon-compat.h"

That seems to be an update mishapp when updating from the old Spark Core lib sd-card-library to sd-card-library-photon-compat.

But even after that correction you’ll find one unrepairable error due to an obscure line #define Serial Serial which breaks the library.