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
#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