General

DFPlayer + WeMos

userHead Account cancelled 2017-09-08 00:09:50 3615 Views1 Replies
Hi
I'm trying to run a simple mp3 track when a button is pressed.
Unfortunately this is not working without the mp3_next() and the delay() functions...

Can anyone help understand why?

thanks


#include <SoftwareSerial.h>
#include <DFPlayer_Mini_Mp3.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxx";
char pass[] = "yyyy";
char auth[] = "abcd";

SoftwareSerial mySerial(D1, D3); // RX, TX

BLYNK_WRITE(V4){
if (param.asInt()){
Serial.println("Direction is forward ");
mp3_play (3);
}
}

void setup () {
Serial.begin (115200);
mySerial.begin (9600);
mp3_set_serial (mySerial); //set softwareSerial for DFPlayer-mini mp3 module
mp3_set_volume (15);
Blynk.begin(auth, ssid, pass);
}


//
void loop () {
//static int i=1;
Blynk.run();
}
2017-09-20 02:17:23 Hi
Do you plan to use Blynk to control DFPlayer
Normally you need to have long delay time than the length of the song, but when playing the song, the Busy pin is high, maybe you can use it to detect if the song is over.
userHeadPic robert.chen