Hello to you,
First of all, I apologize in advance if I'm ignorant. I'm a beginner.
Essentially, I get inspired by pre-existing projects/codes that I adapt.
I wanted to test using an MP3 player on an Arduino Mega board.
I was inspired by this code: Arduino Mega 2560 and DFPlayer Mini - #8 by UptownKitten
The problem: I can't hear any music.
In the code, there is obviously a test to see if the MP3 player is properly connected. The problem is that I did some tests (unpluging the MP3 player, removing the SD card) and this test doesn't seem to work, as the monitor keeps telling me "DFPlayer Mini online."
So, I'm not sure my DFPlayer is working correctly.
What could be the source of the problem?
Thank you very much for your help!
Attached my connection and my code
#include <DFPlayerMini_Fast.h>
DFPlayerMini_Fast myMP3;
void printDetail(uint8_t type, int value);
void setup() {
//Serial2.begin(9600);
Serial.begin(9600);
myMP3.begin(Serial2, true);
Serial.println(F("Initializing DFPlayer..."));
//Use softwareSerial to communicate with MP3
Serial.println(myMP3.begin(Serial2));
if (!myMP3.begin(Serial2)) {
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);
}
if (myMP3.begin(Serial2)) {
Serial.println(F("DFPlayer Mini online."));
}
//Set volume value (From 0 to 30)
myMP3.volume(30);
}
void loop() {
myMP3.play(1);
}