Have been wrestling with the DFPlayer mini (cheapo copy) and have most of the functionality.
But I can't get an accurate folder count.
I Have microSDCard loaded up with album folders which are numbered 01, 02,...93
I wrote a copy files facility in C# so as the folders and files load onto the card in the right sequence
File names are as they are on the PC not 001.mp3 etc, but everything else does work with them and sometimes this does and sometimes not.
myDFPlayer.readFolderCounts() returns -1
If I loop through myDFPlayer.readFileCountsInFolder(folderCount) it works correctly on some folders but not on all. (returns -1)
(looping through that does seem to slow down after about 15 loops)
I have tried looping backwards from 99 to try and find the first folder with files but it doesn't stop at the correct 93 but 89 or 87.
I have tested to find out that it is not the files in the folders that cause this as if I load up a card with a different number of folders it may find fileCount of a folder that it didn't before.
This is the same on different SDCards, new and newly formatted.
It's driving me nuts as I have all the functionality working apart from this.
I have tried on Nanos and ESP32s.
I have implemented IR remote control facility.
The myDFPlayer.readFolderCounts() is returning the folder count.
I have changed the setTimeOut I had at 1000 to 2000
myDFPlayer.setTimeOut(2000); //Set serial communication time out 500ms.
I'd also moved it up to top of the reads bit. Haven't tested putting it back further down.
Off out for some fresh air.
folderCount = myDFPlayer.readFolderCounts();
finalTrackNo = getFinalTrackNo(); #ifdef DEBUG
Serial.print("folderCount DF "); //Number of folders on the SD card
Serial.println(folderCount);
Serial.println(myDFPlayer.readState()); //read mp3 state
Serial.println(myDFPlayer.readVolume()); //read current volume
Serial.println(myDFPlayer.readEQ()); //read EQ setting
Serial.println(myDFPlayer.readFileCounts()); //read all file counts in SD card
Serial.println(myDFPlayer.readCurrentFileNumber()); //read current play file number
I have those with the YDX5200 Chip. I got wrong count results too. After trying different things i found the final solution for me. I call the command simply 2 or 3 times.
Sounds stupid but this helped.
Maybe there is a bug in the library. I don't know.
Hey guys, sorry but i have the same error and i don't fix iti yet, could you help me?
i tryed change setTimeOut too but i'm in the same...
Im using arduino mega, is there any problem?