DYSV17Fmp3
Library for the DY-SV17F mp3 player
Loading...
Searching...
No Matches
DYSV17Fmp3 Class Reference

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.

Detailed Description

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.)

Constructor & Destructor Documentation

◆ DYSV17Fmp3()

DYSV17Fmp3::DYSV17Fmp3 ( Stream & stream,
uint8_t busyPin )

Construct a new DYSV17Fmp3 object.

Parameters
streamReference to the Stream object for communication with the MP3 module
busyPinArduino pin number connected to the MP3 module's busy output

Member Function Documentation

◆ begin()

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.

◆ isBusy()

bool DYSV17Fmp3::isBusy ( )

Get the current busy state of the MP3 player.

Returns
true if MP3 player is busy (playing or processing)
false if MP3 player is idle

◆ playNumber()

bool DYSV17Fmp3::playNumber ( uint8_t songNumber)

Play a track by its number/index.

Parameters
songNumberTrack number to play (0-63 typical range)
Returns
true if command was sent successfully
false if command failed

◆ playString()

bool DYSV17Fmp3::playString ( const char * path)

Play a track by its filename or path.

Parameters
pathFilename or path to the track (max 16 characters)
Returns
true if command was sent successfully
false if path was invalid

◆ playStringWait()

bool DYSV17Fmp3::playStringWait ( const char * path)

Play a track by its filename or path and waits for busy.

Parameters
pathFilename or path to the track (max 16 characters)
Returns
true if command was sent successfully and module is busy
false if command failed or path was invalid

◆ reset()

void DYSV17Fmp3::reset ( )

sends the software reset command

◆ setVolume()

void DYSV17Fmp3::setVolume ( uint8_t volume)

Set the volume of the MP3 player.

Parameters
volumeVolume level (0-30 typical range for DY-SV17F)

◆ stop()

void DYSV17Fmp3::stop ( )

Stops the current playback.

◆ update()

void DYSV17Fmp3::update ( )

monitors the busy line to produce debug output

◆ waitForBusyChange()

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.

Parameters
timeoutMsMaximum time to wait in milliseconds
Returns
true if state changed, false if timeout occurred

The documentation for this class was generated from the following files: