Component: DFPlayer (MP3 / WAV) (Audio Output): Difference between revisions
Appearance
No edit summary |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 82: | Line 82: | ||
===GetError=== | ===GetError=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetError''' | ||
|- | |- | ||
| colspan="2" | Checks for any errors and returns the error code. 1=ModuleBusy, 2=SleepMode, 3=SerialError, 4=ChecksumError, 5=TrackOutOfScope, 6=TrackNotFound, 7=InsertionError, 8=SDFail, 10=Sleep | | colspan="2" | Checks for any errors and returns the error code. 1=ModuleBusy, 2=SleepMode, 3=SerialError, 4=ChecksumError, 5=TrackOutOfScope, 6=TrackNotFound, 7=InsertionError, 8=SDFail, 10=Sleep | ||
| Line 96: | Line 96: | ||
===GetReplyByte=== | ===GetReplyByte=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetReplyByte''' | ||
|- | |- | ||
| colspan="2" | Reads a single byte from the last reply. Each reply contains 4 bytes starting with the command code. | | colspan="2" | Reads a single byte from the last reply. Each reply contains 4 bytes starting with the command code. | ||
| Line 115: | Line 115: | ||
===Initialise=== | ===Initialise=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | Sets up the UART and does some housekeeping. Must be called before calling any of the other component macros. | | colspan="2" | Sets up the UART and does some housekeeping. Must be called before calling any of the other component macros. | ||
| Line 129: | Line 129: | ||
===IsPlaying=== | ===IsPlaying=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''IsPlaying''' | ||
|- | |- | ||
| colspan="2" | Checks to see if the last played track is still playing | | colspan="2" | Checks to see if the last played track is still playing | ||
| Line 143: | Line 143: | ||
===IsReplyAvailable=== | ===IsReplyAvailable=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''IsReplyAvailable''' | ||
|- | |- | ||
| colspan="2" | Checks to see if new data has been received from the module. Returns true when new data is available. Collect the data using the GetReplyByte macro. | | colspan="2" | Checks to see if new data has been received from the module. Returns true when new data is available. Collect the data using the GetReplyByte macro. | ||
| Line 157: | Line 157: | ||
===PausePlayResetStop=== | ===PausePlayResetStop=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''PausePlayResetStop''' | ||
|- | |- | ||
| colspan="2" | Allows the current playing track to be paused, restarted or reset | | colspan="2" | Allows the current playing track to be paused, restarted or reset | ||
| Line 176: | Line 176: | ||
===PlayTrack=== | ===PlayTrack=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''PlayTrack''' | ||
|- | |- | ||
| colspan="2" | Plays track from the selected folder. MP3 & Advert folder track numbers should be 4 characters long e.g. 0001 any name.mp3, Other folder track numbers should be 3 characters long e.g. 001 Any name.mp3, Root the Track played in placement order. | | colspan="2" | Plays track from the selected folder. MP3 & Advert folder track numbers should be 4 characters long e.g. 0001 any name.mp3, Other folder track numbers should be 3 characters long e.g. 001 Any name.mp3, Root the Track played in placement order. | ||
| Line 200: | Line 200: | ||
===SendCommand=== | ===SendCommand=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SendCommand''' | ||
|- | |- | ||
| colspan="2" | Sends a command to the DFPlayer module | | colspan="2" | Sends a command to the DFPlayer module | ||
| Line 229: | Line 229: | ||
===SetEQ=== | ===SetEQ=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetEQ''' | ||
|- | |- | ||
| colspan="2" | Sets the equaliser mode for the module | | colspan="2" | Sets the equaliser mode for the module | ||
| Line 248: | Line 248: | ||
===SetVolume=== | ===SetVolume=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetVolume''' | ||
|- | |- | ||
| colspan="2" | Sets the volume level for the module | | colspan="2" | Sets the volume level for the module | ||
| Line 267: | Line 267: | ||
===SkipTrack=== | ===SkipTrack=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SkipTrack''' | ||
|- | |- | ||
| colspan="2" | Jump to the next or previous track | | colspan="2" | Jump to the next or previous track | ||
| Line 286: | Line 286: | ||
===WhilePlaying=== | ===WhilePlaying=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''WhilePlaying''' | ||
|- | |- | ||
| colspan="2" | Blocking function that waits for module to stop being busy. Returns true if the module is still busy and the timeout period has passed. | | colspan="2" | Blocking function that waits for module to stop being busy. Returns true if the module is still busy and the timeout period has passed. | ||
| Line 306: | Line 306: | ||
==Property reference== | ==Property reference== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Connections | ||
|- | |- | ||
|- | |- | ||
| Line 346: | Line 346: | ||
| colspan="2" | Controls if we are monitoring the busy pin or not. Used by the IfBusy component macro. | | colspan="2" | Controls if we are monitoring the busy pin or not. Used by the IfBusy component macro. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Simulation | ||
|- | |- | ||
|- | |- | ||
Latest revision as of 14:36, 13 July 2026
| Author | Matrix TSL |
| Version | 1.0 |
| Category | Audio Output |
DFPlayer (MP3 / WAV) component
A small module capable of streaming MP3 and WAV audio files from a micro SD card. Controlled via a serial UART connection to the microcontroller.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_DFPlayer.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_DFPlayer.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No Examples here yet
Macro reference
GetError
GetReplyByte
| GetReplyByte | |
| Reads a single byte from the last reply. Each reply contains 4 bytes starting with the command code. | |
| Index | |
| Range: 0-3 / 0=Command, 1=Feedback, 2=Data MSB, 3=Data LSB | |
| Return | |
Initialise
| Initialise | |
| Sets up the UART and does some housekeeping. Must be called before calling any of the other component macros. | |
| Return | |
IsPlaying
| IsPlaying | |
| Checks to see if the last played track is still playing | |
| Return | |
IsReplyAvailable
| IsReplyAvailable | |
| Checks to see if new data has been received from the module. Returns true when new data is available. Collect the data using the GetReplyByte macro. | |
| Return | |
PausePlayResetStop
| PausePlayResetStop | |
| Allows the current playing track to be paused, restarted or reset | |
| Mode | |
| 0=Pause, 1=Play, 2=Reset, 3=Stop | |
| Return | |
PlayTrack
SendCommand
| SendCommand | |
| Sends a command to the DFPlayer module | |
| Command | |
| Command code byte | |
| Feedback | |
| Collect feedback byte: Range 0-1 | |
| Parameter | |
| 16-bit Parameter | |
| Return | |
SetEQ
| SetEQ | |
| Sets the equaliser mode for the module | |
| EQMode | |
| Range: 0-5 0=Normal, 1=Pop, 2=Rock, 3=Jazz, 4=Classic, 5=Bass | |
| Return | |
SetVolume
| SetVolume | |
| Sets the volume level for the module | |
| Volume | |
| Range: 0 (min) - 30 (max) | |
| Return | |
SkipTrack
| SkipTrack | |
| Jump to the next or previous track | |
| Direction | |
| 0=Next, 1=Previous | |
| Return | |
WhilePlaying