arduino stuffs
Diffstat (limited to 'mp3player/arduino/player.h')
-rw-r--r--mp3player/arduino/player.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/mp3player/arduino/player.h b/mp3player/arduino/player.h
new file mode 100644
index 0000000..7ea9b6e
--- /dev/null
+++ b/mp3player/arduino/player.h
@@ -0,0 +1,26 @@
+#ifndef PLAYER_H
+#define PLAYER_H
+#include "DFRobotDFPlayerMini.h"
+#include "error.h"
+#include <SoftwareSerial.h>
+
+namespace Player {
+SoftwareSerial s(10, 11); // RX, TX
+DFRobotDFPlayerMini p;
+
+void begin() {
+ Serial.println("Initializing DFPlayer");
+
+ s.begin(9600);
+
+ if (!p.begin(s))
+ Error err("init failed");
+
+ Serial.println("DFPlayer online.");
+
+ p.volume(5); // Set volume value. From 0 to 30
+ p.play(1); // Play the first mp3
+ Serial.println(p.readFileCounts());
+}
+} // namespace Player
+#endif \ No newline at end of file