Hi to all,
this i my first Arduino project and my first post in this forum.
I use a DFPlayer Mini to play a random sound file from SD-Card triggered by a motion detector. This setup is perfectly working. I also have a Button and status LED for turning on and off the motion detection and a separate Button wit LED for pause/resume the clip. Everything works as expected.
I added two more buttons for next/previous song. They also work great.
Only the play/pause button makes trouble when used together with the next/previous buttons: Sometimes (not always!) it does not resume the song after paused but jumps to the first song in internal order. It makes no difference if I use the hardware Pins on the Player or coded buttons for previous/next.
It works correctly when playing the random clip from the motion detector, but not when starting the song with prev/next buttons, no matter if software driven or with hardware pins. And there is no difference if I put the clips in root or in MP3 folder.
Any ideas?
This is the Player: DFPlayer Mini Mp3 Player - DFRobot Wiki
The library I use: DFPlayer Mini Ansteuerung mit dem Arduino • Wolles Elektronikkiste
The part of the code for the play/pause functionality:
/* in the setup: */
bool Pause = false;
/* in the loop: */
// pause/play blue Button, blue LED
if (button_b.released()) {
if (busyState == LOW) {
Pause = true;
myDFPlayer.pause(); // pause if playing
digitalWrite(LEDb, HIGH);
}
else {
Pause = false;
myDFPlayer.start(); // start if not playing
digitalWrite(LEDb, LOW);
}
}
Thank you!