disable button during mp3 file playback


I am making a triggerable mp3 player. It uses a push button and a serial mp3 player. My code is working fine except for the fact that the length of time of the sound files loaded onto the sd card will change depending on application.

So essentially how i have it now is if the button is triggered and it plays the first track and then i have a delay in the code which doesn’t allow the button to be triggered again for 10s. After that 10s you can push trigger the button again and it will play the 2nd track and so on. The problem is that each sound file is a different length so the 10s delay does not work for all situations. I need a way to prevent the button from being triggered for the duration of each of the sound files. It ranges anywhere from 5s to 1 min.

I have tried many different things but just can’t figure it out. If anyone has a solution to this problem please let me know.

Here is a link to the serial mp3 player: http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf


mp3_button_revised.ino (3.32 KB)

What did you try ?

Tried it using a variety of delay() and also an END_FILE function.

delay() is not going to work unless you know how long each track is and can code it into the program.

What does the END_FILE function do ?