//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.
void loop()
{
if (digitalRead(5) == HIGH) player.volumeUp();
if (digitalRead(6) == HIGH) player.volumeDown();
digitalWrite(12, HIGH); delay(200);
delay(1000);
player.next();
delay (25000);
digitalWrite(12, LOW);
delay(25000);
}
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.play(1);
player.playFolder(1, 1);
player.playMp3Folder(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.
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.
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.
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.