DFPlayer Mini Module non-working commands

//DFPlayer: Mini mp3 Player
//Library GitHub - DFRobot/DFRobotDFPlayerMini: Arduino library for DFPlayer
#include "SoftwareSerial.h"
#include "Arduino.h"
#include "DFRobotDFPlayerMini.h"
#include <SoftwareSerial.h>
SoftwareSerial softwareSerial(10, 11);
DFRobotDFPlayerMini player;

Why do commands like player.next(); and player.previous(); work, while commands like player.play(1); player.volume(10); and player.playFolder(15, 4); don’t work? I’m trying to use then as commands in the void loop(). In my void loop the audio will play a 12 second diesel train horn every 5-4 minutes, aka for what every time delay(); I have set.

Post all of your code and pictures or a diagram of your setup.
Check this out:

void loop()
if (digitalRead(5) == HIGH) player.volumeUp();
if (digitalRead(6) == HIGH) player.volumeDown();
digitalWrite(12, HIGH); delay(200);
delay (25000);
digitalWrite(12, LOW);
Is there a WEB site that lists the commands that DFRobotDFPlayerMini.h supports?

I'm obviously missing something. I've tried many of the (myDFPlayer.-----) commands in

and only a couple of them work.
using only player.next(); or player.previous(); will suffice but I'd like to get these three working;
player.playFolder(1, 1);
I could do so much more with these three

Start by stripping your setup down to the simplest machine necessary to use the mp3 module. It looks like you have more going on currently.
Then, follow a tutorial that walks you through your hardware configuration and the commands.
After you get that working you can add the other stuff in one piece at a time.

What you’re seeing is a schematic and code per

In the picture’s center is a bridge rectifier, a big cap and a switching voltage regulator supplying 5VDC. Exclusive of the one of the LEDs, everything else in including the is in accordance with: https://akuzechie.blogspot.com/2021/04/arduino-based-mp3-player
You don’t see the five push buttons as I use a jumper to simulate the buttons. My void loop() eliminates much of the WEB sites code as I tried to get rid of stuff hoping to make more of the player.-----(); calls function.

You've made changes to the circuit by removing the buttons and you made changes to the code. Somewhere therein is your problem.

My suggestion is that you go back to an exact match including buttons. Get it to work correctly exactly as they have it.

Then, eliminate things again, but only one piece at a time. Check every function each time you eliminate a single button or a few related lines of code.

That way when it stops working you can just check the last thing you did.

I put the schematic and the code back to:

It works as advertised, but that not what I want. The code for play the next MP3 is as below:

if (digitalRead(2) == HIGH)

I commented out the player.next(); line and added a player.play(1); line. It should now play the first MP3 in the 01 folder.

if (digitalRead(2) == HIGH)
// player.next();

It does nothing; I tried it as 01 and 001 also. I also tried player.playFolder(1, 1); and player.playMp3Folder(1); neither work.
Although I didn’t try them all, my conclusion is that pretty much only the commands used in the example function. I put it back to the original with player.next(); and it went back to working.

Can you use those functions to achieve your ends, even if it's a slightly different plan than you planned?

if player.play(1); worked it would fit into my plans. without it I'll have go with much reduced plans

So you want to play by index?
Use a variable to know your current track and a for loop that calls the next() equal to the index - current_track, or previous() as the case my be.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.