- Tue Dec 01, 2020 5:50 am
#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:
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
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