Has anyone got a DfPlayerMini Mp3 player to work on an Esp8266 with SoftwareSerial?
Could you let me know what settings to use?
In the sketch I have:
#include <DFPlayer_Mini_Mp3.h>
#include <SoftwareSerial.h>
#define DFPLAYER_RX_PIN 0 // for debug so serial monitor will work.
#define DFPLAYER_TX_PIN 2 // for debug so serial monitor will work.
SoftwareSerial dfplayerSerial(DFPLAYER_RX_PIN, DFPLAYER_TX_PIN); // RX, TX. connect to reciprocal module pins.
void setup(){
dfplayerSerial.begin(9600, SWSERIAL_8N1, DFPLAYER_RX_PIN, DFPLAYER_TX_PIN, false, 256);
mp3_set_serial (dfplayerSerial);}
When I run the sketch it has an error that it can't set the player serial, because it thinks the software serial is a hardware serial:
Halloween_Box_Head_Skeleton1.ino: In function void setup()
Halloween_Box_Head_Skeleton1.ino: 99:33: error: invalid initialization of reference of type 'HardwareSerial&' from expression of type 'SoftwareSerial
mp3_set_serial (dfplayerSerial)
Halloween_Box_Head_Skeleton1.ino:17: In file included from
DFPlayer_Mini_Mp3.h: 78:6: error: in passing argument 1 of 'void mp3_set_serial(HardwareSerial&)
void mp3_set_serial (HardwareSerial &theSerial)
Error compiling project sources
Build failed for project 'Halloween_Box_Head_Skeleton1'
I downloaded the espsoftwareserial library but I don't understand if it's being used or not, it seems very confusing as to what to do with this library so that it is used correctly in my sketch with Esp8266, what do you have to do?
In the DFPlayer_Mini_Mp3 source files there are 2 definitions for the "mp3_set_serial" function:
void mp3_set_serial (HardwareSerial &theSerial);
//
void mp3_set_serial (SoftwareSerial &theSerial);
If I comment out all references to the hardware serial option in the .h and .cpp files I get this error instead:
Halloween_Box_Head_Skeleton1.ino: In function void setup()
Halloween_Box_Head_Skeleton1.ino: 99:33: error: 'mp3_set_serial' was not declared in this scope
mp3_set_serial (dfplayerSerial)
So I think my SoftwareSerial is not working right with Esp8266, because I have compiled a similar sketch with a Pro Mini Uno and it runs fine.
Thanks!