i have some mixed types of files on SD card ( .wav .mid .jpeg .txt)
i wrote code to store audio files names to array. i don't know how many file are in sd root . i took
i guess these are not more than 256.
then i function in void setup
the function
have
now
is became Test1.WAV . i can see it in Serial Monitor
but it cannot be used in
getting error
as
function use
file name with inverted comas instead of
please reply ... How to convert
into useable audio file name . how to use it in
????????????????????
Thank you
i wrote code to store audio files names to array. i don't know how many file are in sd root . i took
C++:
#define MAX_FILES 256
String filenames[MAX_FILES];
then i function in void setup
C++:
for (int i = 0; i < MAX_FILES; i++) { READ_SD_FILE_NAME (); }
C++:
READ_SD_FILE_NAME ();
Code:
void READ_SD_FILE_NAME () {
{ File root = SD.open("/"); // Open the root directory
if (root) {
while (true) {
File entry = root.openNextFile();
if (!entry) {
// No more files
break;
}
if (!entry.isDirectory()) { // Only store actual files, not directories
if (fileCount < MAX_FILES) { // Ensure you don't exceed array bounds
String filename = entry.name();
if (filename.endsWith(".WAV") || filename.endsWith(".wav"))
{ filenames[fileCount] = filename;
filenames[fileCount].toUpperCase(); // Convert to uppercase for case-insensitive comparison
fileCount++; }
}
}
entry.close();
}
root.close();
}
else {
Serial.println("Error opening root directory From SD Card");
}
}
}
C++:
filenames[fileCount]
C++:
Serial.println(filenames[fileCount]);
Code:
playSdWav1.playWav(filenames[fileCount]);
Code:
no matching function for call to 'AudioPlaySdResmp::playWav(String&)'
Code:
playSdWav1.playWav();
Code:
"Test1.WAV"
Code:
Test1.WAV
Code:
filenames[fileCount]
Code:
playSdWav1.playWav(filenames[fileCount]);
Thank you