Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: **Audio Playback**
- - Source Code NOT compiled for: ESP32 DevKit V1
- - Source Code created on: 2025-05-01 07:16:55
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* enabling a obsidian esp32 board and pirate audio */
- /* hat */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <SoftwareSerial.h> //https://github.com/plerup/espsoftwareserial
- #include <DFRobotDFPlayerMini.h> //https://github.com/DFRobot/DFRobotDFPlayerMini
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF Software Serial *****/
- const uint8_t myDFPlayer_DFPlayerMini_Serial_PIN_SERIAL_TX_D4 = 4;
- const uint8_t myDFPlayer_DFPlayerMini_Serial_PIN_SERIAL_RX_D13 = 13;
- EspSoftwareSerial::UART myDFPlayer_DFPlayerMini_Serial;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- // Instantiate the DFPlayer Mini object
- DFRobotDFPlayerMini myDFPlayer;
- void setup(void)
- {
- // put your setup code here, to run once:
- // Initialize Software Serial
- myDFPlayer_DFPlayerMini_Serial.begin(9600, SWSERIAL_8N1, myDFPlayer_DFPlayerMini_Serial_PIN_SERIAL_RX_D13, myDFPlayer_DFPlayerMini_Serial_PIN_SERIAL_TX_D4, false);
- // Initialize DFPlayer Mini
- myDFPlayer.begin(myDFPlayer_DFPlayerMini_Serial);
- myDFPlayer.volume(10); // Set volume level (0-30)
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- // Example: Play a track
- myDFPlayer.play(1); // Play the first track
- delay(1000); // Wait for 1 second before playing again
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement