Df mini player playing issue

I expect full track, but It only playing 4~5 sec and replayed
Is there any wrong with HW or SW?

#include <DFMiniMp3.h>
#include <DfMp3Types.h>
#include <Mp3ChipBase.h>
#include <Mp3ChipIncongruousNoAck.h>
#include <Mp3ChipMH2024K16SS.h>
#include <Mp3ChipOriginal.h>
#include <DFRobotDFPlayerMini.h>
#include <SoftwareSerial.h>


SoftwareSerial mySerial(10,11); // RX, TX
DFRobotDFPlayerMini DF;

void setup()
{
  mySerial.begin(9600);
  Serial.begin(9600);
  Serial.println();
  Serial.println(F("DFRobot DFPlayer Mini Demo"));
  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));

  if (!DF.begin(mySerial)) {  //Use softwareSerial to communicate with mp3.
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
    while(true);
  }
  Serial.println(F("DFPlayer Mini online."));
  DF.volume(10);
  delay(100);
}
 
void loop()
{
      DF.playMp3Folder(2);
      delay(1000);
}


But you are restarting the code every second with that loop function.

You have to look at the serial input from the DF player to see if it is still busy before starting it off again on a new or different track.

Also you are using a lot of libraries, do you need all of them?

This looks like a half decent version of how to do the code:-

I’d second the recommendation from @Grumpy_Mike to use only <DFRobotDFPlayerMini.h> , a widely used, versatile library. And echo the question about why you’re using all those other libraries?

But does that rather basic sketch resolve your main question about playing tracks in full? Of course, if they’re all of the same duration, no problem. But otherwise you might amplify a bit on your requirements please.

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