Importing new Library which uses SoftwareSerial.h

Hi, I’m trying to import a library for the DFPLayer Mini

The import went well, but when I tried to compile the code got errors regarding the lines:
#include “Arduino.h”
#include “SoftwareSerial.h”

I replaced those lines with:
#include “application.h”

But still getting errors regarding the serial commands such as:
DFPlayer_Mini_Mp3/DFPlayer_Mini_Mp3.h:81:22: error: variable or field ‘mp3_set_serial’ declared void
void mp3_set_serial (HardwareSerial &theSerial);

Is there an equivalent for #include “SoftwareSerial.h” ?
Is there something else I’m missing?
my git is here

many thanks!

You could check this topic :smile:
A great & very cheap MP3 sound module without need for a library!

@yurikleb, software serial is not supported on the Particle due to the interrupt overhead it uses. However, the photon already has an extra hardware serial port (Serial1) on the TX/RX pins and the Electron has three more! I believe someone already has done some work on this module on the forum:

Nonetheless, it would be easy to port the library. I finally received my units recently so I’ll look into porting this week. :smile:

This is great!
thanks for the quick reply, I’ll follow the thread in the link you guys provided,
please update as loon as you have the library ported!

many thanks again!

1 Like

DFRobotDFPlayerMini Library examples in its latest rev in the library suppository have not been ported to use the Serial1 hardware and instead use software serial . Do I just // out any referenced to software serial ?

OK these are the fixes to DFPlayer-fullfunction.ino

//#include “Arduino.h”
//#include “SoftwareSerial.h”

void setup()
{
//mySoftwareSerial.begin(9600);
Serial1.begin(9600);…

/* 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);
}
*/

if (!myDFPlayer.begin(Serial1)) { // use Serial1 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);
}