MemoryCard (highlevel SD card access) library alpha1 release

Have questions about a SparkFun product or board? This is the place to be.

Moderators: phalanx, TS-Tim

MemoryCard (highlevel SD card access) library alpha1 release

Postby follower » Sun Aug 29, 2010 9:09 pm

Hi all...

I'm writing up a tutorial based on a project I've been working on and in the process I've extracted a high-level wrapper library for SD card access. I thought some people might be interested in using it for their own purposes.

An alpha release is available from:

The library wraps the standard sdfatlib library and provides some higher-level functions and provides four key benefits:

  • Including `MemoryCard.h` automatically creates a global `MemoryCard` object which can be interacted with in a similar manner to other standard global objects like `Serial` and `Ethernet`.

  • Boilerplate initialisation code is contained in one method named `begin` and no further objects need to be created in order to access the memory card.

  • Calls to `open` can supply a full path name including parent directories which simplifies interacting with files in subdirectories.

  • Utility methods are provided to determine whether a file exists and to create a directory heirarchy.

Note however that not all functionality provided by the underlying sdfatlib library is exposed.

Example use:

Code: Select all


 if (MemoryCard.exists("/apple/banana/cabbage/")) {
 }"/apple/banana/cabbage/dolphin.txt", true);

 MemoryCard.file.println("This line was appended to the file.");


I'm not entirely happy with the API (in terms of file interaction and read/write control) but it's a start and worked for the purpose for which I needed it.

Feel free to provide feedback.

Posts: 280
Joined: Sun Mar 14, 2010 11:58 pm

Return to SparkFun Product Questions

Who is online

Users browsing this forum: No registered users and 8 guests