Hoje vamos trabalhar com DFPlayer módulo mp3
Aqui o esquema:
Onde pode ser comprado:
comprar no Ebay
Aqui a programação:↓↓↓⇩⇩⇟⇟⇓⇓⇊⇊⇊↴↴↯↯
// Criado por Gaspar Pereira//
#include <SoftwareSerial.h>
#include <DFPlayer_Mini_Mp3.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup () {
Serial.begin (9600);
mySerial.begin (9600);
mp3_set_serial (mySerial); //set softwareSerial for DFPlayer-mini mp3 module
delay(10); // delay 1ms to set volume
Serial.begin (9600);
mySerial.begin (9600);
mp3_set_serial (mySerial); //set softwareSerial for DFPlayer-mini mp3 module
delay(10); // delay 1ms to set volume
mp3_reset();
delay(1000);
delay(1000);
mp3_set_volume (10); // value 0~30
delay(10);
delay(10);
}
void loop () {
if (Serial.available()) {
char command = Serial.read();
void loop () {
if (Serial.available()) {
char command = Serial.read();
switch (command) {
case ‘S’:
mp3_stop();
delay(10);
break;
case ‘N’:
mp3_next();
delay(10);
break;
case ‘P’:
mp3_prev();
delay(10);
break;
}
}
}
case ‘S’:
mp3_stop();
delay(10);
break;
case ‘N’:
mp3_next();
delay(10);
break;
case ‘P’:
mp3_prev();
delay(10);
break;
}
}
}
Comentários
Enviar um comentário