|
DYSV17Fmp3
Library for the DY-SV17F mp3 player
|
Controls a DY-SV17F MP3 player module. More...
#include <DYSV17Fmp3.h>
Public Member Functions | |
| DYSV17Fmp3 (Stream &stream, uint8_t busyPin) | |
| Construct a new DYSV17Fmp3 object. | |
| void | begin () |
| Initialize the MP3 player module. | |
| void | update () |
| monitors the busy line to produce debug output | |
| void | reset () |
| sends the software reset command | |
| void | stop () |
| Stops the current playback. | |
| void | setVolume (uint8_t volume) |
| Set the volume of the MP3 player. | |
| bool | playNumber (uint8_t songNumber) |
| Play a track by its number/index. | |
| bool | playString (const char *path) |
| Play a track by its filename or path. | |
| bool | playStringWait (const char *path) |
| Play a track by its filename or path and waits for busy. | |
| bool | isBusy () |
| Get the current busy state of the MP3 player. | |
| bool | waitForBusyChange (uint32_t timeoutMs=250) |
| Wait for busy state to change or timeout. | |
Controls a DY-SV17F MP3 player module.
The DYSV17Fmp3 class manages communication with the DY-SV17F MP3 player module. It handles sending commands, calculating checksums, and processing responses. The class is designed to work with any Stream object (HardwareSerial, SoftwareSerial, etc.)
| DYSV17Fmp3::DYSV17Fmp3 | ( | Stream & | stream, |
| uint8_t | busyPin ) |
Construct a new DYSV17Fmp3 object.
| stream | Reference to the Stream object for communication with the MP3 module |
| busyPin | Arduino pin number connected to the MP3 module's busy output |
| void DYSV17Fmp3::begin | ( | ) |
Initialize the MP3 player module.
Sets up the busy pin as input and sends initial configuration commands including volume setting. Should be called once during setup.
| bool DYSV17Fmp3::isBusy | ( | ) |
Get the current busy state of the MP3 player.
| bool DYSV17Fmp3::playNumber | ( | uint8_t | songNumber | ) |
Play a track by its number/index.
| songNumber | Track number to play (0-63 typical range) |
| bool DYSV17Fmp3::playString | ( | const char * | path | ) |
Play a track by its filename or path.
| path | Filename or path to the track (max 16 characters) |
| bool DYSV17Fmp3::playStringWait | ( | const char * | path | ) |
Play a track by its filename or path and waits for busy.
| path | Filename or path to the track (max 16 characters) |
| void DYSV17Fmp3::reset | ( | ) |
sends the software reset command
| void DYSV17Fmp3::setVolume | ( | uint8_t | volume | ) |
Set the volume of the MP3 player.
| volume | Volume level (0-30 typical range for DY-SV17F) |
| void DYSV17Fmp3::stop | ( | ) |
Stops the current playback.
| void DYSV17Fmp3::update | ( | ) |
monitors the busy line to produce debug output
| bool DYSV17Fmp3::waitForBusyChange | ( | uint32_t | timeoutMs = 250 | ) |
Wait for busy state to change or timeout.
Blocks until the busy pin state changes or timeout occurs. Useful for waiting for command completion.
| timeoutMs | Maximum time to wait in milliseconds |