Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6850

MicroPython • Re: MP3-Player with Pico and DFPlayer Mini

$
0
0
Having read the datasheet, how do you put the module into random playback mode?

My plan was to switch between random- and sequence-mode by holding the play/pause-button. That all actually works.

After tinkering a bit, I simplified (at least from my point of view) the randomization by using a variable x that is constantly being reset for each loop. The logging-part that ChatGPT came up with works, but until I have figured out my main problem, I'll ignore that :)

My main problem is, that the DFPlayer (or the library im using) plays entire files, as long as nothing is interrupting them. In other words, when I set up a finite number of playbacks without using loops, the pause/resume-function works like a charm.

But when I want to set up a loop, where the files are played back one after another, it either stops the playback every loop to check if a button has been pressed, or the buttons become useless. I think I understand how and why this happens, but I am at a loss when it comes to a solution.

In other words: how can I set up a loop that checks for button inputs without interrupting said loop?

Statistics: Posted by CptAmmogeddon — Fri Apr 04, 2025 7:21 pm



Viewing all articles
Browse latest Browse all 6850

Trending Articles