This might help point you in the right direction:
https://github.com/sparkfun/MicroMod_Ma … /SD/SD.ino