#43628
Hello! I'm making a simple MP3 player with a Nano and the DFPlayer. I'd like to have an on/off switch and one button operation.

Goals:
  • Turn the unit on and it starts playing the first song
    When a song is finished, it plays the next song
    If the button is pressed, it skips to the next song
    If it reaches the end of the list of songs, it starts back at the beginning
    A 15 or 30 minute timer to stop playing - so it doesn't just loop forever if left on

So far I have found sample code at https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299 that uses a timer to play a song for a certain amount of time before skipping to the next song. In this forum I have also seen code for playing one song or looping a song or all songs. However, it isn't clear to me how to create a loop that waits for the current song to complete and then goes to the next song - without knowing how long the current song is. Also the code for the button - I assume I would tie a function to a digital input on the Nano that just plays the next song?

Any examples or code snippets you could offer for the functions I describe above would be greatly appreciated. I'm very new to all of this.

Thanks!
Jon
#43704
Thank you very much! I see the full function example now and it's clear - thank you!
One other question for using the DFPlayer Mini on it's own without an Arduino (section 3. I/O Mode in the instructions). I hooked it all up and it works great, but I noticed that it only plays one song and then stops, until you temporarily ground IO1 to go to the next song. Is there a way in this I/O mode to have it continue to play the next song or does that require the Arduino setup with code?
Thanks again!
Jon
#43708
Oh, sorry, another note - it looks like I could do this with the AD KEY Mode and the different resistor values. Yes? However, if I trigger Loop All with K3 and then later hit K6 to skip to the next song, will it then continue on looping all the songs, or will it stop after that song because K6 took it out of the loop all mode?
Thanks again!
Jon