-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDF_Mini_only.ino
36 lines (29 loc) · 871 Bytes
/
DF_Mini_only.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
Electronics Studio
@file DF_Mini_only.ino
@date 13-10-2024
@url https:https://github.com/electronicsstudio
*/
#include "DFRobotDFPlayerMini.h"
#include <HardwareSerial.h>
// Use the hardware serial ports on the ESP32
DFRobotDFPlayerMini player;
HardwareSerial mySerial(2); // Initialize hardware serial port 2
void setup()
{
Serial.begin(115200);//
mySerial.begin(9600, SERIAL_8N1, 16, 17); // RX = 16, TX = 17
Serial.println("Initializing DFPlayer...");
if (!player.begin(mySerial)) {
Serial.println("Unable to begin:");
Serial.println("1. Please recheck the connection!");
Serial.println("2. Please insert the SD card!");
while (true);
}
Serial.println("DFPlayer Mini online.");
player.volume(10); // Set volume value (0~30)
player.play(1); // Play the first MP3 file
}
void loop() {
// Nothing to do here
}