-
Notifications
You must be signed in to change notification settings - Fork 0
/
noiseless_df.ino
57 lines (43 loc) · 1.6 KB
/
noiseless_df.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <Arduino.h>
#include "DFRobotDFPlayerMini.h"
HardwareSerial mySoftwareSerial(1);
DFRobotDFPlayerMini myDFPlayer;
void setup() {
mySoftwareSerial.begin(9600, SERIAL_8N1, 5, 18);
Serial.begin(115200);
Serial.println();
Serial.println(F("DFRobot DFPlayer Mini Demo"));
Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
if (!myDFPlayer.begin(mySoftwareSerial)) {
Serial.println(myDFPlayer.readType(), HEX);
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);
}
Serial.println(F("DFPlayer Mini online."));
myDFPlayer.setTimeOut(500);
myDFPlayer.volume(1); // Set volume value (0~30).
myDFPlayer.volumeUp();
myDFPlayer.volumeDown();
myDFPlayer.EQ(DFPLAYER_EQ_NORMAL);
myDFPlayer.outputDevice(DFPLAYER_DEVICE_SD);
int delayms = 100;
Serial.println(F("readState--------------------"));
Serial.println(myDFPlayer.readState());
Serial.println(F("readVolume--------------------"));
Serial.println(myDFPlayer.readVolume());
Serial.println(F("readFileCounts--------------------"));
Serial.println(myDFPlayer.readFileCounts());
Serial.println(F("readCurrentFileNumber--------------------"));
Serial.println(myDFPlayer.readCurrentFileNumber());
Serial.println(F("readFileCountsInFolder--------------------"));
Serial.println(myDFPlayer.readFileCountsInFolder(3));
Serial.println(F("--------------------"));
Serial.println(F("myDFPlayer.play(1)"));
delay(1000);
myDFPlayer.play(1);
delay(1000);
}
void loop() {
}