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.
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.
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