DFP Player Error

Hi folks this is my 1st try at an upload so please be kind…
The sketch I have (for blaster sounds and lights) states a DFP Player

``"#include “Arduino.h”
#include “SoftwareSerial.h”
#include “DFRobotDFPlayerMini.h”

SoftwareSerial mySoftwareSerial(8,9); // RX, TX

DFRobotDFPlayerMini myDFPlayer;"``

In have two in the liberties section, see attachment screen shot 1

When I Verift the sketch I get an error messages for the Makuna player

see attachment … Error
I take it the issue is two liberies ?
and that I need to stop it looking at the Makuna one ?

If so is there a way to remove the Makuna libery i assume that’s the issue ???

I was happy i managed to add liberies but then this happened I take it I am not the first or the last
Be I want to learn and thought this would be a start point i got the sketch from a tutorial.
We need to fall so we can pick ourselves up… I just need a hand to get up :slight_smile:

All help much appreshiated but please go easy as I have NO other knowledge yet !!

Regards

Chris

error.txt (21 KB)

Start by posting your complete sketch using code tags when you do

what are code tags please ?
I assume you mean cur paste into this type of text window ?
As I said this is my first try sorry

Regards

Chris

#include <DFMiniMp3.h>

#include <DFMiniMp3.h>



/***************************************************
Plastic Arms Dealer Sound and Light Board
V1.2
JUNE 9, 2019
Andrew McClary
Copyright 2018 All Rights Reserved

UPDATES:
- Changed pin outs for Arduino Micro
****************************************************/

#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(8,9); // RX, TX

DFRobotDFPlayerMini myDFPlayer;

void printDetail(uint8_t type, int value);

int triggerButton = 4; //the pin where we connect the button



//Output Pins to turn lights on
int LED1 = 6; //the pin we connect the Blaster LED
int LED2 = 7; //the pin we connect the Blaster LED

int fireSound = 1;


void setup()
{
mySoftwareSerial.begin(9600);
Serial.begin(115200);
pinMode(triggerButton, INPUT_PULLUP); //set the button pin as INPUT


pinMode(LED1, OUTPUT); //set the LED pin as OUTPUT
pinMode(LED2, OUTPUT); //set the LED pin as OUTPUT



Serial.println();
Serial.println(F("Plastic Arms Dealer Blaster Sound System beta 2.1 May 2020"));
Serial.println(F("Initializing Sound Player ... (May take 3~5 seconds)"));

//This sets up the code and connects with the MP3 player
if (!myDFPlayer.begin(mySoftwareSerial)) {  //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("Plastic Arms Dealer Blaster Sound System online."));
Serial.println(F("Folder 1."));
Serial.println(myDFPlayer.readFileCountsInFolder(1)); //read fill counts in folder SD:/1
Serial.println(F("Folder 2"));
Serial.println(myDFPlayer.readFileCountsInFolder(2)); //read fill counts in folder SD:/03
Serial.println(F("Folder 3"));
Serial.println(myDFPlayer.readFileCountsInFolder(3)); //read fill counts in folder SD:/03
myDFPlayer.volume(30);  //Set volume value. From 0 to 30 

//Play startup sound
myDFPlayer.playLargeFolder(03, 1);;

}

//***  This is the main looping code that monitors the buttons ***
void loop()
{
static unsigned long timer = millis();


//This is were the button states are all read
int stateButton = digitalRead(triggerButton); //read the state of the button

//Check for Fire button
if(stateButton == LOW) { //if is pressed
  //Serial.println(F("Fire button Pressed"));
  //Play the sound file
    
    
    //myDFPlayer.next();  //Play next mp3 
   
    myDFPlayer.playLargeFolder(02, fireSound);
    printDetail(myDFPlayer.readType(), myDFPlayer.read());
    
    delay(100);
    
    //Flash the leds
    digitalWrite(LED1, HIGH); //write 1 or HIGH to led pin
    delay(200);
    digitalWrite(LED1, LOW); //write 1 or HIGH to led pin
    delay(100);
    digitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
    delay(100);
    digitalWrite(LED2, LOW); //write 1 or HIGH to led pin
    delay(50);
    digitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
    delay(200);
    digitalWrite(LED2, LOW); //write 1 or HIGH to led pindigitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
    delay(50);
    digitalWrite(LED2, HIGH); //write 1 or HIGH to led pindigitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
    delay(100);
    digitalWrite(LED2, LOW); //write 1 or HIGH to led pin

    //Change the blaster sound
    fireSound++;
    Serial.print("Fire Button Pressed - ");
    Serial.print(fireSound);
    if (fireSound >= 10){
        fireSound = 1;
                      }
  }

  

}  //END Loop

void printDetail(uint8_t type, int value){
switch (type) {
case TimeOut:
  Serial.println(F("Time Out!"));
  break;
case WrongStack:
  Serial.println(F("Stack Wrong!"));
  break;
case DFPlayerCardInserted:
  Serial.println(F("Card Inserted!"));
  break;
case DFPlayerCardRemoved:
  Serial.println(F("Card Removed!"));
  break;
case DFPlayerCardOnline:
  Serial.println(F("Card Online!"));
  break;
case DFPlayerPlayFinished:
  Serial.print(F("Number:"));
  Serial.print(value);
  Serial.println(F(" Play Finished!"));
  break;
case DFPlayerError:
  Serial.print(F("DFPlayerError:"));
  switch (value) {
    case Busy:
      Serial.println(F("Card not found"));
      break;
    case Sleeping:
      Serial.println(F("Sleeping"));
      break;
    case SerialWrongStack:
      Serial.println(F("Get Wrong Stack"));
      break;
    case CheckSumNotMatch:
      Serial.println(F("Check Sum Not Match"));
      break;
    case FileIndexOut:
      Serial.println(F("File Index Out of Bound"));
      break;
    case FileMismatch:
      Serial.println(F("Cannot Find File"));
      break;
    case Advertise:
      Serial.println(F("In Advertise"));
      break;
    default:
      break;
  }
  break;
default:
  break;
}
}

Hi Chris,

</>

Edit your original post, select the text that represents your code, click on the </> icon and save.

I see there is a copy for forum option so I hope this is better ?
Little steps move along the road to a goal

#include <DFMiniMp3.h>

#include <DFMiniMp3.h>



/***************************************************
Plastic Arms Dealer Sound and Light Board
V1.2
JUNE 9, 2019
Andrew McClary
Copyright 2018 All Rights Reserved

UPDATES:
 - Changed pin outs for Arduino Micro
 ****************************************************/

#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(8,9); // RX, TX

DFRobotDFPlayerMini myDFPlayer;

void printDetail(uint8_t type, int value);

  int triggerButton = 4; //the pin where we connect the button
 


//Output Pins to turn lights on
int LED1 = 6; //the pin we connect the Blaster LED
int LED2 = 7; //the pin we connect the Blaster LED

int fireSound = 1;


void setup()
{
   mySoftwareSerial.begin(9600);
  Serial.begin(115200);
   pinMode(triggerButton, INPUT_PULLUP); //set the button pin as INPUT
   
   
  pinMode(LED1, OUTPUT); //set the LED pin as OUTPUT
  pinMode(LED2, OUTPUT); //set the LED pin as OUTPUT
  
 
  
  Serial.println();
  Serial.println(F("Plastic Arms Dealer Blaster Sound System beta 2.1 May 2020"));
  Serial.println(F("Initializing Sound Player ... (May take 3~5 seconds)"));

  //This sets up the code and connects with the MP3 player
  if (!myDFPlayer.begin(mySoftwareSerial)) {  //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("Plastic Arms Dealer Blaster Sound System online."));
  Serial.println(F("Folder 1."));
  Serial.println(myDFPlayer.readFileCountsInFolder(1)); //read fill counts in folder SD:/1
  Serial.println(F("Folder 2"));
  Serial.println(myDFPlayer.readFileCountsInFolder(2)); //read fill counts in folder SD:/03
  Serial.println(F("Folder 3"));
  Serial.println(myDFPlayer.readFileCountsInFolder(3)); //read fill counts in folder SD:/03
  myDFPlayer.volume(30);  //Set volume value. From 0 to 30 
 
  //Play startup sound
  myDFPlayer.playLargeFolder(03, 1);;
 
}

//***  This is the main looping code that monitors the buttons ***
void loop()
{
    static unsigned long timer = millis();

    
    //This is were the button states are all read
    int stateButton = digitalRead(triggerButton); //read the state of the button
  
    //Check for Fire button
    if(stateButton == LOW) { //if is pressed
      //Serial.println(F("Fire button Pressed"));
      //Play the sound file
        
        
        //myDFPlayer.next();  //Play next mp3 
       
        myDFPlayer.playLargeFolder(02, fireSound);
        printDetail(myDFPlayer.readType(), myDFPlayer.read());
        
        delay(100);
        
        //Flash the leds
        digitalWrite(LED1, HIGH); //write 1 or HIGH to led pin
        delay(200);
        digitalWrite(LED1, LOW); //write 1 or HIGH to led pin
        delay(100);
        digitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
        delay(100);
        digitalWrite(LED2, LOW); //write 1 or HIGH to led pin
        delay(50);
        digitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
        delay(200);
        digitalWrite(LED2, LOW); //write 1 or HIGH to led pindigitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
        delay(50);
        digitalWrite(LED2, HIGH); //write 1 or HIGH to led pindigitalWrite(LED2, HIGH); //write 1 or HIGH to led pin
        delay(100);
        digitalWrite(LED2, LOW); //write 1 or HIGH to led pin

        //Change the blaster sound
        fireSound++;
        Serial.print("Fire Button Pressed - ");
        Serial.print(fireSound);
        if (fireSound >= 10){
            fireSound = 1;
                          }
      }

      
  
}  //END Loop

void printDetail(uint8_t type, int value){
  switch (type) {
    case TimeOut:
      Serial.println(F("Time Out!"));
      break;
    case WrongStack:
      Serial.println(F("Stack Wrong!"));
      break;
    case DFPlayerCardInserted:
      Serial.println(F("Card Inserted!"));
      break;
    case DFPlayerCardRemoved:
      Serial.println(F("Card Removed!"));
      break;
    case DFPlayerCardOnline:
      Serial.println(F("Card Online!"));
      break;
    case DFPlayerPlayFinished:
      Serial.print(F("Number:"));
      Serial.print(value);
      Serial.println(F(" Play Finished!"));
      break;
    case DFPlayerError:
      Serial.print(F("DFPlayerError:"));
      switch (value) {
        case Busy:
          Serial.println(F("Card not found"));
          break;
        case Sleeping:
          Serial.println(F("Sleeping"));
          break;
        case SerialWrongStack:
          Serial.println(F("Get Wrong Stack"));
          break;
        case CheckSumNotMatch:
          Serial.println(F("Check Sum Not Match"));
          break;
        case FileIndexOut:
          Serial.println(F("File Index Out of Bound"));
          break;
        case FileMismatch:
          Serial.println(F("Cannot Find File"));
          break;
        case Advertise:
          Serial.println(F("In Advertise"));
          break;
        default:
          break;
      }
      break;
    default:
      break;
  }
}

Hi Perry,
my fault currently I can only reply after 5 min intervals so my reply's where and may still appear out of sink.
Many thanks for your reply I understood that it was a big help, fully understood.

Learnt a new skill :slight_smile:

Thank You.

IMHO both of the libraries you’re trying to use suck. This one is easier to use and executed faster: GitHub - PowerBroker2/DFPlayerMini_Fast: Fast and easy to understand Arduino library to use the DFPlayer Mini MP3 module from DFRobot.com. This is a huge improvement (both in terms of execution speed and simplicity) to the standard library provided by DFRobot.com.. Also, no need to use multiple libraries for the same thing.

Many thanks for the suggestion will this solve the problem I am asking about as i already have two librarys loaded will adding a 3rd help solve the question I am asking about ???

In actuality, Power Broker is 100 % correct. Take a look at the Mini Fast library example and compare it to the two you are using. Its WAY shorter and easier to understand. In what appears to be a Laser Blaster sound effect with LED’s, your code is way too complex for what it needs. It should be :

State 1: Startup sound with LEDs

and then
State 2: Fire the Blaster
Play Fire Sound
Use LED’s.

Yours is using different folders, which appears to be unneccessary for what you need. I encourage you to spend some time with the example file in Mini Fast and give that a try. Delete the other two libraries and use it.

I thank you all for your input but please try to see this from a new Member point of view;

I asked a question because I dont know the answer (the main reason questions are asked)

I may seen obvious to some even why ask to others, easy I dont know the answer.

So posted in the wrong place ... Is subjective but even so then be helpfull and say were to move it to I would as Multi posting is not allowed. As stated I am new

Post code with tags again assumption I understand tags.

Comment the Librarys your trying to use suck... would help if it answered my question however its no use other than it would add another 3rd Library.

Comment the sketch it to long winded... usfull as I move on but dosnt answer the question.

To add more background that is irrelevant to the question asked.
The Sketch came as a download with all the hardware I purchased from a vender. I can see the potential of Aldrino based projects for my hobby and those within it. So I chose to look further and learn. However at my 1st attempt to load the sketch I hit a snag and ask for help. Assuming people like to help others I do it feels good.

So from my point of view I have spent $$$ dollard hit a snag asked a question had a number of replies, am 4 days further on and have a costume part done as i cannot fit the blaster because I can fit the electronics, But I have learnt;

I have the ability to load questions in the wrong place.

I have learnt how to post code (that was very usfull and well put by Perry, even though the person asking for the code to be better posted as moved on it would appear so little help from there just criticism)

I have two Librarys that suck apparently.

A potential Better library (above me at prsent)

and an origonal question still standing.

While I fully appershiate that people on these forums offer there help freely and at the own time and are not paid, on the flip side they too new nothing once as I said I am new to this its not my field but I want to learn.

As a new member seriously if you had the above responses would you feel that its help answer my question ?

Weather it seems obvious to you or not I asked because i dont know the answer (and still dont) and wish to learn.

Seriously why is it being such hard work. I can see why a number of new members have posted as they have.
OK on some responces they needed not of put "stick it up...." but they like must have been so frustrated because the simple question wasn't answered folks were to busy telling them things that at that time did and would not help them to move on.

again assumption I understand tags.

If you had taken note of the advice in Read this before posting a programming question then you would have posted your problem in a more helpful way and perhaps have got more helpful answers.

The sticky posts at the top of the forum page are there for a reason, that is to help newcomers get the best out of the forum

UKHeliBob:
If you had taken note of the advice in Read this before posting a programming question then you would have posted your problem in a more helpful way and perhaps have got more helpful answers.

The sticky posts at the top of the forum page are there for a reason, that is to help newcomers get the best out of the forum

Wow that implies because I didn't do something in a specific way folks are being unhelpful because of it ?

I have done all that has been asked of me by those who replied and were helpful instruction was given
(I think helpful is the point if you only had more like Perry who helped).
FYI I am Dyslexic and reading long areas of text I find very difficult,
Sorry for that I posted in the incorrect location (subjective to be fare)
Sorry I didn't understand the tags question. (Thanks to Perry for helping)

However I wont apologise for wanting to learn,
I wont apologise that those who have responded (with comments that dont help) but appears have not read my question fully by there responses ????

From reading a number of other newbies questions this type of response is typical sadly.
We want to learn so why 1st send us for a caining ?

People say stay off forums. I want to learn and the forum and its members I thought are there to help those who want to learn, even if they have a learning disability but maybe like many in "Clubs" as you move up the ladder they forget there roots and feel that asking some things are stupid and obvious to others
The bases of a question being asked is because the answer is unknown to the person asking no matter how obvious the answer appears to others.

Why when someone wishes to learn and better themselves increase there knowledge do you give this type of response ?

I had hoped this was not going to be like this but as you say
"posted your problem in a more helpful way and perhaps have got more helpful answers."

That is the kind of response you used to get in the playground. "You didn't help me I wont help you" some people become teachers because of that type of mentality they strive to teach and help,
others enjoy being "I know something you dont know".

You who answer and comment as you do on posts its you who decide what the Forums there for and there reputation outside of school.
A school that only has downtrodden pupils is a sad place with fewer and fewer new pupils and a bad reputation ?
You choose

that implies because I didn't do something in a specific way folks are being unhelpful because of it ?

Not at all.

It means that because you didn't do things in the most helpful way it makes it more difficult to provide help. As I said previously, those sticky posts are there for a reason

I am sorry i dont now an easier way to ask this .....

"I take it the issue is two liberies ?
and that I need to stop it looking at the Makuna one ?

If so is there a way to remove the Makuna libery i assume that's the issue ???"

Must be very very difficult for anyone to understand judging from the responses,
there must be no way to remove a library. I worked out the issue / problem I just wanted help to remove it
looking at the responses, even you Helibob as I posted with the tags as you requested and ????????????????
Well ???????????
Helped how ????????????????
Did you help me further ?????????????????

Or is it that with all your experience and that of the fellow posters you dont know?
Then fine but stop making me jump through needless hoops PLEASE.
I want to move on and learn way all the walls ?

stop making me jump through needless hoops PLEASE.

If code is not posted in code tags then it can be corrupted by the forum software interpreting parts of it as HTML commands, hence the request to use them.

Worse, if a poster only posts part of a sketch then it is impossible to know what is going on in the rest of it. A classic problem is multiple declaration of the same variable with a different scope. Without seeing the whole sketch it is impossible to know whether that has been done, hence the request to post the whole sketch or a small but complete example that demonstrates the problem

Having seen your complete sketch I do not know what is wrong and I don't have the hardware or libraries to test it, which is why I have made no suggestions regarding the code, but I see little point in posting a reply saying that I don't know what is wrong

I will keep an eye on this topic and contribute if I think that I can help

Good luck with your project

Helibob, I give in I think .....

The question was and still is this,

If so is there a way to remove the Makuna libery i assume that's the issue ???"

The post says

In have two in the liberties section, see attachment screen shot 1

When I Verify the sketch I get an error messages for the Makuna player

see attachment .... Error

I take it the issue is two liberies ?
and that I need to stop it looking at the Makuna one ?

If so is there a way to remove the Makuna library I assume that's the issue ???

If anyone looked at the attachment labelled acreen shot I it shows I have two librarys loading.
(see the attachment I took the time to take and post for clarity)

I need to remove the one in the error message "Makuna" ALL THIS I worked out by myself so i didnt add the full sketch as I thought it may muddy the waters (and it has)

The question still is this and simply this......

If so is there a way to remove the Makuna libery i assume that's the issue ???

The error message looks for Makuna, its not in the sketch so it throws and error its like i ask you to go look for a fork and a knife in the drawer but the drawer dosnt have any forks it does have knives so you happily come back with the knife but no fork you will keep looking for the fork until i stop asking for the fork so...

Knife = DFRobot (OK)

Fork = MP3 By Makuna (OK)

I need to stop looking for forks as there are none ok ?

So How do i remove the Forks (Makuna library) ?

Is this easier for people top follow please I just Need to remove the incorrect Library
and i dont know how !

It complied fine on my laptop i didn't add that library so i now thats the issue.

Chris - you are not going to like this but I am going to post it anyway

If anyone looked at the attachment labelled acreen shot I it shows I have two librarys loading.

No it doesn't, rather it shows that you have 2 libraries installed. They will not be included into the sketch unless you or another library explicitly #includes them

It complied fine on my laptop i didn't add that library so i now thats the issue.

That is possibly the most important piece of information that you have provided but not mentioned until now.
What version of the IDE is your laptop running and where was it downloaded from ?
What version of the IDE is your other PC running and where was it downloaded from ?

To delete the DFPlayer_Mini_Mp3_by_Makuna library delete the entire folder that it is in from the libraries folder in your sketchbook directory. If you don't know where that is then look in File/Preferences in the IDE

ok so tell me this then please

only difference is my laptop DOES NOT have the makuna library while the PC DOES

everything esle is the same inc the same IDE installed on both devices via my cloud (Western Digital PC World £69 in sale)

It complied with no errors at all nothing using the same sketch.

While the pc DOES have the other library installed in the library folder and the errors list that library as the issue ?

"No it doesn't, matter that it shows that you have 2 libraries installed. They will not be included into the sketch unless you or another library explicitly #includes them."

There is no mention of the Makuna Libary in the sketch (as far as I can see) so by your statement above it should not come up as an error so then why does it ???

At this point ready to take up plastering as if I cant solve this we cant move forward can we ?

As a point of interest I have removed the Makuna Library from the pc library folder (now i know how :wink: and all compiles fine on the PC ???

Lost me I used logic and apparently its not that easy. Please can someone show me the error in the sketch as it cost me a pritty pennie and i would hate others to fall fowl if I can just get the chap who wrote it to amend the issue.

The error message that you posted with your original post in this thread says

In file included from C:\Users\chrissmith\Documents\Arduino\Blaster_Pro_Mini\Blaster_Pro_Mini.ino:1:0:

This seems to indicate that the DFPlayer_Mini_Mp3_by_Makuna library was #included in the sketch

As to the actual errors, such as

C:\Users\chrissmith\Documents\Arduino\libraries\DFPlayer_Mini_Mp3_by_Makuna\src/DFMiniMp3.h:120:26: error: 'uint16_t' has not been declared

     void playGlobalTrack(uint16_t track = 0)

will have been caused by the fact that the functions that error have default values for their arguments. Normally C/C++ programs require that functions are declared before they are used either by placing them before their first use or by putting a function prototype before their first use but the Arduino creates the function prototypes for you to keep things simple. However, this does not work for functions with default values for parameters