Trying to upload this example program to my Uno IDE for my MP3-TF-16P player but keep getting DFRobotDFPlayerMimi.h: No such file or directory.
Any ideas on the problem greatly appreciated.
Thanks
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);
void setup()
{
mySoftwareSerial.begin(9600);
Serial.begin(115200);
Serial.println();
Serial.println(F("DFRobot DFPlayer Mini Demo"));
Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
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("DFPlayer Mini online."));
myDFPlayer.volume(10); //Set volume value. From 0 to 30
myDFPlayer.play(1); //Play the first mp3
}
void loop()
{
static unsigned long timer = millis();
if (millis() - timer > 3000) {
timer = millis();
myDFPlayer.next(); //Play next mp3 every 3 second.
}
if (myDFPlayer.available()) {
printDetail(myDFPlayer.readType(), myDFPlayer.read()); //Print the detail message from DFPlayer to handle different errors and states.
}
}
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;
}
}
Yes i did. Thanks
I tried several examples provided and all of them have the same problem or other issues.
For example another program rejects it and says "myserial1 does not name a type; did you mean serial1?"
First of all, I will recommend you to focus on only one sketch for now. If you are switching from one sketch to another during the troubleshooting process that will introduce additional variables into the situation and lead to confusion. Once you have that first sketch working, you are welcome to try the other ones.
Once you have selected the sketch you want to focus on, try compiling it. If it works, then all is well. If not, then please do this:
When you encounter an error, you'll see a button on the right side of the orange bar in the Arduino IDE: Copy error messages. Click that button.
Open a forum reply here by clicking the Reply button.
Click the </> icon on the post composer toolbar. This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
Press Ctrl+V. This will paste the compilation output into the code block.
Move the cursor outside of the code block markup before you add any additional text to your reply.
Great. Thank you so much!! I was confused on how to do this.
Arduino: 1.8.16 (Windows Store 1.8.51.0) (Windows 10), Board: "Arduino Uno"
In file included from C:\Users\kjame\Documents\Arduino\libraries\DFPlayerMini_Fast\examples\example\example.ino:1:0:
C:\Users\kjame\Documents\Arduino\libraries\DFPlayerMini_Fast\src/DFPlayerMini_Fast.h:22:10: fatal error: FireTimer.h: No such file or directory
#include "FireTimer.h"
^~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
When you see a "No such file or directory" error it almost always means you need to install the library that contains the missing file. That is the case here. You are probably already accustomed to needing to install the Arduino libraries your sketch uses. But in some cases those libraries also use other libraries. That is the case here. The "DFPlayerMini_Fast" library has a dependency on the "FireTimer" library so in order to use the "DFPlayerMini_Fast" library you must also install the "FireTimer" library. You can do that easily via the Arduino IDE's Library Manager:
Select Sketch > Include Library > Manage Libraries... from the Arduino IDE's menus.
Wait for the update to finish.
In the "Filter your search" field, type "FireTimer".
Press Enter.
Scroll down through the list of libraries until you see"FireTimer by PowerBroker2". Click on it.
Click the Install button.
You may now get a dialog asking:
Would you like to install also all the missing dependencies?
I also like to have detailed instructions to follow when I'm having trouble with something. When things aren't working correctly and I'm terribly confused, I don't want any ambiguity to leave me with doubts about whether I did things correctly.
For this reason, I always try to write instructions that don't leave any step out, no matter how trivial it might seem. My goal is that if someone follows the instructions exactly, they will always be guaranteed to have the expected result when they arrive at the last step.