-
Hoping someone can help. I’m trying to play files one after the other by specifying the file numbers, but I can’t figure out how to have the loop wait for the current file to finish before playing the next file. The files are speech samples, used to add text-to-speech functionality to an Arduino project. I want the files to play back to back with no (or as small as possible) delay as if they were joined together. So basically: object.play(1); The part I’m stuck on is getting the files of different lengths to play in this way, without resorting to delays and knowing the exact length. The files always get cut off. I’m basically struggling with the ‘if is playing’ bit. I've tried using the module's 'busy' pin with digitalRead but I'm still not getting anywhere. I'm sure there's something simple I'm missing, but I'd be grateful if someone can point me in the right direction or even offer a code sample to achieve what I'm trying to do. The DFPlayer mini is connected to an Arduino Nano using software serial. Any suggestions greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
In your notification class (examples use the name Mp3Notify), the method |
Beta Was this translation helpful? Give feedback.
In your notification class (examples use the name Mp3Notify), the method
OnPlayFinished(DfMp3& mp3, DfMp3_PlaySources source, uint16_t track)
will be called when any track finishes playing. Just implement code that uses the passed track to figure out what the next track should be and call play with it.