PDA

View Full Version : Play a file in subfolder



darioconcilio
02-12-2016, 12:28 PM
Hi,
I'm trying to play on subfolder of SD, but I don't know which way I have to take.

I tryed to call open methods, as I use when I keep a files, but I think that is a bad way.
Infact, it take no effect.

have you got any idea?




[...]

mixer.gain(0, 0.8);
mixer.gain(1, 0.8);
AudioMemory(8);
pinMode(10, OUTPUT);
SPI.setMOSI(11);
SPI.setSCK(13);
if (!(SD.begin(10))) {
// stop here, but print a message repetitively
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
SD.open("/MYSUBFOLDER/"); //Is it good way? .....it's not works....

sdwav1.play("MYAUDIO1.WAV");

PaulStoffregen
02-12-2016, 01:51 PM
Have you tried?



sdwav1.play("MYSUBFOLDER/MYAUDIO1.WAV");


But of course, you'd name your folder with 8 or fewer characters, or figure out the short 8.3 name for it. SD only supports 8.3 filenames.

darioconcilio
02-12-2016, 03:33 PM
Ok! it works.
Thank you.