8 years, 7 months ago.

How to use with SD card

Hi, I have a file on my SD card "config.txt" that I would like to read from (not using the local filesystem as in your example).

I can't work out what to change in the example to read from the SD card instead of the local filesystem.

Can anyone provide some guidance please?

Question relating to:

A test program for ConfigFile library. Config, file

2 Answers

8 years, 7 months ago.

Short version: Change

LocalFileSystem local("local");

to

SDFileSystem sdCard(SD_MOSI , SD_MISO , SD_CLK , SD_nCS , "local");

where SD_MOSI, SD_MISO, SD_CLK & SD_nCS are the pins used for those signals on your board.

Accepted Answer

Hi, this helped me. I was already using the SD card but couldn't work out how to integrate the ConfigFile with what I was already doing. I ended up changing the word 'local' with 'sd' as I am using in my SDFileSystem command. Thank you.

posted by Glendon Turner 24 Sep 2015
8 years, 7 months ago.

Hi Glendon,

Please have a look at this page: https://developer.mbed.org/cookbook/SD-Card-File-System

and let us know if you need more guidance.

Cheers Miloje