Home Forums Sparkfun MP3 Shield Library Support Forum Triggering mp3 file over serial Reply To: Triggering mp3 file over serial


Try FileNamePlayer.ino on my GISTHUB

It should be just what you are looking for.

Although take note that the Arduino IDE Serial Monitor sends out a few bytes of garbage, that may cause a little of confusion.

This sketch listens for commands from a serial terminal which are TERMINATED with New Line Feeds (aka “\n” or 0xA). To use this sketch enable Serial Monitor to use NewLine’s.
If the Serial message is 1 byte in length and terminated by LF, the byte will be processed as menu command.
If the Serial Message is larger than 1 byte it will assumed a FileName and that file will be attempted to be played. Note the max length of string is 8.3 or 11 bytes long.

So with this you can send the actual filename exactly as seen in the listing.

Enter 1-9,f,F,s,d,+,-,i,>,<,p,r,R,t,m,M,g,k,h,O,o,D,S,V,l,01-65534 :
[MPF: I sent “TRACK001.mp3” + LF using Serial Monitor]
Received > “TRACK001.mp3”
Playing = TRACK001.mp3

You can still send commands such as “s” to stop but they too need to be “s”+<LF>