Serial.begin(9600) //Start our Serial coms for serial monitor in our pc #define SET_DAC 0X17//data is needed 00 start DAC OUTPUT 01 DAC no output #define SET_CYCLEPLAY 0X19//data is needed 00 start 01 close #define PLAY_FOLDER 0X17// data is needed 0x7E 06 17 00 01 XX EF (play the 01 folder)(value xx we dont care) #define CMD_PLAY_WITHFOLDER 0X0F//DATA IS NEEDED, 0x7E 06 0F 00 01 02 EF (play the song with the directory \01\002xxxxxx.mp3 #define CMD_PAUSE 0X0E //PLAYBACK IS PAUSED #define DEV_TF 0X02 //HELLO,IM THE DATA REQUIRED #define CMD_SEL_DEV 0X09 //SELECT STORAGE DEVICE, DATA IS REQUIRED #define CMD_PLAY_WITHVOLUME 0X22 //data is needed 0x7E 06 22 00 xx yy EF (xx volume)(yy number of song) #define CMD_SET_VOLUME 0X06//DATA IS REQUIRED (number of volume from 0 up to 30(0x1E)) #define CMD_PLAY_W_INDEX 0X03 //DATA IS REQUIRED (number of song) 0X7E FF 06 command 00 00 00 EF (if command =01 next song order) Static int8_t Send_buf = //The MP3 player undestands orders in a 8 int string all the commands needed in the datasheet() SoftwareSerial mySerial(ARDUINO_RX, ARDUINO_TX) //init the serial protocol, tell to myserial wich pins are TX and RX #define ARDUINO_TX 6//connect to RX of the module #define ARDUINO_RX 5//should connect to TX of the Serial MP3 Player module I tried this code found on this project, but nothing happens : //code rearranged by Javier Muñoz ask me at So i received the module and tried to use it separately with a Uno first to understand it better. ideally i want the arduino to play one song on it's own after other action in the code (like activiting the steppers and relays). ėE FF 06 3D 00 00 01 EFğile has ended playing.I'm trying to use YX5300 module in a project with Arduino Mega and also steppers motors and relays. 7E FF 06 3B 00 00 00 EF SD Card Removed No 7E FF 06 3A 00 00 00 EF SD Card inserted No Response Name Response String (HEX) Response Description Query required QUERY_TOT_FLDR 7E FF 06 4F 00 00 00 EF Query number of folders ėE FF 06 4E 00 00 00 EF Query total files in folder. ėE FF 06 4C 00 00 00 EF Query which track is playing ėE FF 06 48 00 00 00 EF Query total files in all folders ėE FF 06 44 00 00 00 EF Query current equalizer ėE FF 06 43 00 00 00 EF Query Volume level. ėE FF 06 42 00 00 00 EF Query Device Status ėE FF 06 28 00 01 00 EF Playback shuffle mode for folder specified. ėE FF 06 22 00 01 0E EF Play track at the specified volume. 7E FF 06 19 00 00 01 EF Close single cycle play [Cycle play with 7E FF 06 17 00 01 02 EF 01 folder cycle play 7E FF 06 0F 00 01 02 EF Play the song with the directory:/01/002xxx.mp3 7E FF 06 0E 00 00 00 EF Playback is paused 7E FF 06 0A 00 00 00 EFĜhip enters sleep mode 7E FF 06 09 00 00 02 EF Select storage device to TF card ėE FF 06 08 00 00 01 EF Single cycle play the first song 7E FF 06 06 00 00 1E EF Set the volume to 30 (0x1E is 30) 7E FF 06 05 00 00 00 EF Volume decrease one 7E FF 06 04 00 00 00 EF Volume increased one ėE FF 06 03 00 00 01 EF Play the first songħE FF 06 03 00 00 02 EF Play the second song 7E FF 06 02 00 00 00 EF Play previous song Here is a list of all the command codes for the YX5300 that I could find the forth byte is the command and the sixth and seventh bytes are any data needed by the command:Ĭommand NameĜommand String (HEX)Ĝommand Description One of my early mistakes with the YX5300 module was trying to play WMA files. Per the illustration, stick with 001.MP3 002.MP3 etc to be safe. Nothing else works.Įdit: my YX5300 can use files named 001-1stMarker.MP3 but perhaps yours can't. Note that the uSD card must have specific folder names (only 01,02,03.) and the files within those folders must be named 001xxxx.MP3, 002yyyy.MP3, 003zzzz.MP3.) per the attached illustration. Trying those to verify that the player is functional would be prudent, only then move on to using the serial commands. Your DF mini has more input pins than the YX5300 I used, providing direct access to play, track select and volume functions. There are several troubleshooting threads in that forum, such as and one moderator comment points to their product page at with two datasheets there. You probably know this already since the link you provided is from Picaxe.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |