В скетч добавте эффек FADE
#include <SoftwareSerial.h>
#include "DFPlayer_Mini_Mp3.h"
#define PIN_BUTTON 5
#define PIN_LED 7
#define PIN_BUSY 2
SoftwareSerial mySerial(3, 4); // RX, TX
int fsmState = 0;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin
pinMode(PIN_BUTTON, INPUT);
digitalWrite(PIN_BUTTON, HIGH);
pinMode(PIN_LED, OUTPUT);
digitalWrite(PIN_LED, LOW);
pinMode(PIN_BUSY, INPUT);
digitalWrite(PIN_BUSY, HIGH);
Serial.begin(9600);
mySerial.begin (9600);
mp3_set_serial (mySerial); //set softwareSerial for DFPlayer-mini mp3 module
mp3_set_volume (25);
}
// the loop function runs over and over again forever
void loop() {
switch (fsmState) {
case 0:
if (!digitalRead(PIN_BUTTON))
{
delay(100);
if (!digitalRead(PIN_BUTTON))
{
delay(100);
if (!digitalRead(PIN_BUTTON))
{
fsmState++;
digitalWrite(PIN_LED, HIGH);
}
}
}
break;
case 1:
if (digitalRead(PIN_BUTTON))
{
fsmState++;
mp3_next();
delay(100);
}
break;
case 2:
if (digitalRead(PIN_BUSY))
{
digitalWrite(PIN_LED, LOW);
fsmState = 0;
}
break;
}
}