Go Down

Topic: Read filename from SD card, store to a string (Read 4052 times) previous topic - next topic


Where is this from?

Left field. I thought you were trying to read the name FROM a file, not the name OF a file.


Crap ok, found it.

I was using these:

//Add the SdFat Libraries
#include <SdFat.h>
#include <SdFatUtil.h>

not the base SD library.

I see available() now too.


If you'd posted your actual code (in its entirety), we'd have known that.
I only provide help via the forum - please do not contact me for private consultancy.


Nov 06, 2012, 11:24 pm Last Edit: Nov 06, 2012, 11:26 pm by WanaGo Reason: 1
I did say in post #1 I am using the SDFAT library, not the SD library. Also posted pieces of the SDFAT functions. I didnt even know there was a SD library 'wrapper' or whatever its called to be honest.

Tried implmenting the SD library instead, but its not compiling. Looks like the 2012 SDFAT library I am using is not quite the same as the 2009 SDFAT library which is part of the SD library included with Arduino 1.01

No luck so far, will keep trying.


It's easy to find excuses not to, or reasons why we should have guessed or noticed some quirk of your solution, but there's simply no substitute for posting your actual code when you need help with a coding problem.
I only provide help via the forum - please do not contact me for private consultancy.


I'm a real noob, so don't jump on me as I haven't written any code.
I'm looking for a sample of code to do exactly what the OP was trying to do but I stumble into too many issues over creating a dynamic string array and reading each file name. There are too many libraries and I'm not a programmer. I'd appreciate some help.
I need a simple sketch that creates a character array, opens the root directory, reads the names and appends them to the array to allow it to be read and accessed later. This will be used to play .wav files from the card. I have code to read a named .wav file and play it from the SD card but this string manipulation part of the project eludes me.
I have looked at the CardInfo example but can't understand how to move the read list to a script. I've tried to modify the openNextFile example on the arduino reference site, but can't go from printing the file names to adding them to a script. I'm sure that this is simple but it's beyond me.
I know I'm asking for someone to post a short sketch for me, I do hope people don't find this offensive, but I am lost.

Thanks in advance


Go Up