DFPlayer Pro DF1201S

Hi Guys
I am a newbie of note but learning very fast and loving the possibilities of what Arduino can do.

My current problem is I have a DFRobot DFPlayer DF1201s,
When I connect it the audio file plays but runs on repeat. I need to have the file play once and then stop.
I have connected digital pin 11 to the play pin on the board and this could be the problem as maybe the Play pin only triggers a play function and nothing more.
I haven't been able to find much literature on module so reaching out here for some help.
There are also TX/RX pins and as far as I understand I can also use these to trigger Play/Pause.

Which Arduino do you have?

Post your code and a diagram of how you have connected the DFPlayer to your Arduino.

Here is the code I am using. It might be that I need a complete new code.
When I press the button it take a long time now to play the song, there after it plays it a few times in a row and then waits a long delay. This is no where near what I need.
I need to be able to press the button once the song plays to the end and then goes back to the beginning and pauses or waits for the button to be pressed again.

#include <DFRobot_DF1201S.h>
#include <SoftwareSerial.h>

SoftwareSerial DF1201SSerial(2, 3); //RX TX

DFRobot_DF1201S DF1201S;

int buttonPin1 = 5;
int buttonState1 = 0;

void setup(void){
Serial.begin(115200);
DF1201SSerial.begin(115200);
while(!DF1201S.begin(DF1201SSerial)){
Serial.println("Init failed, please check the wire connection!");
delay(1000);
}

DF1201S.setVol(0); // Range 0 - 30
// Alternate method to remove startup voice prompt
DF1201S.switchFunction(DF1201S.MUSIC);
delay(1000);
DF1201S.setPlayMode(DF1201S.SINGLE);
Serial.print("PlayMode:");
Serial.println(DF1201S.getPlayMode());
pinMode(buttonPin1, INPUT);
Serial.println("Input from user required to initiate sequence ");
Serial.println("Input will be active after delay period has ended ");

}

void loop() {

buttonState1 = digitalRead(buttonPin1);

if (buttonState1 == HIGH) {
DF1201S.setVol(10);
Serial.print("VOL:");
Serial.println(DF1201S.getVol());
Serial.print("Playing First Selection... ");
Serial.println(DF1201S.getFileName());
DF1201S.playFileNum(1);
//DF1201S.pause();
delay(12000); // plays for 12s

} 

return;
}

I am using th Uno

Please re-edit your post #3 to put the code between code tags - the </> icon.

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