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


So you must not be using the Arduino’s built in Serial Monitor, as from the sounds of it. Where the IDE’s Serial Monitor does not send each character one at a time, but rather as a whole line.

The original MP3Shield_Library_Demo.ino only accepts one character at a time and processes each character as individual commands when more than one is sent at once.

FilePlayer.ino is different in that for numeric digits it delimits it serial input by Intercharacter Timeout, which is 500 ms as in the below line. Grouping the individual digits into a whole integer.

  } else if ((millis() – last_ms_char) > 500 && ( buffer_pos > 0 )) {

So you are likely typing each character with more than 500ms between them. Causing the ICT to attempt to parse the serial buffer. You can increase the 500ms ICT. Or you can paste the whole command at once. More like the desired Serial.Print would.

Where as it does not ICT for non digits. Where it still processes them individually.

Looking at your trace it looks like you were typing: “track.mp3”. That is not the way FilePlayer.ino works.

Rather you should run the “l” command to

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 :
Received command: l
Music Files found :
00001: DING.wav
00002: TRACK001.mp3
00003: TRACK002.mp3
Enter Index of File to play
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 :

Where you would enter 00003 to play “TRACK002.mp3”. You don’t type in “TRACK002.mp3”.

So if you are sending “TRACK.MP3” I believe it is likely parsing each character as a unique command.

Note also that “f” is a command to play “track001.mp3”.