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

MicroPython • Re: pico W vs. DFPlayer - Raspberry pi and sound

$
0
0
Is there a chance to ask the player when a track runs and when it finishes?
I have always monitored the BUSY output from the DFPlayer. I recall it goes high a short time after it starts playing and then returns low at the end of track.

I have normally waited for the pin to go high, timed-out and assumed it was a track too short to register and already stopped if not, then just looped waiting for that to go low again. So long as you If you wait for the high you should be able to then enable an interrupt on the pin being low to set a reached end of track flag.

There seems to be a number of status requests and query commands which can be sent which should distinguish between playing or not, and I presume 'not' will occur once it reaches the end of track. I have never used those and it may depend on the DFPlayer firmware as to which it supports.

I'd write some test code with BUSY temporarily being monitored and see what happens. Pseudo code -

Code:

StartPlaying(...)while True:  SendQuery(...)  result = ReadReply()  if BUSY.value() : print("PLAYING", result)  else            : print("STOPPED", result)

Statistics: Posted by hippy — Wed Sep 04, 2024 6:57 pm



Viewing all articles
Browse latest Browse all 6016

Trending Articles