Currently, I'm working on a wind turbine project to power an arduino UNO board with a sparkfun MP3 shield on it.
Using the given example code, I can type "001" into the serial monitor and it begins playing the track I have labelled as track001.mp3, so the code works as it was intended to.
My question is: How can I get the song to play as soon as the board receives power? This way once the turbine generates enough power for the board it will begin playing the song without any input. I'm having trouble reading the code myself. Also, I can increase the volume by typing "+" into the serial monitor, so how would I set it to a specific volume on start up?
I'm still a little confused. Where in the code would I put that? I tried placing it after the first #endif in the void loop, just before "char inByte" but it doesn't start. Also how do I know the file name? Is it just the actual file name (track001.mp3) or does the microSD read it differently?
PaulS:
Wherever you want the track to start playing.
When you send a number, n, via the serial port, the current code plays the nth track on the card.
That's just it though, I'm trying to bypass the serial monitor input. Maybe I don't properly understand what you're saying, but what I want it to do is immediately start playing once the board turns on, without any human input at all.
Or if there's a way to automatically input a serial byte that would be great. I just need to play a single song.
You can name the files Joe.bob, Sam.nut, and Freak.out. When you enter 3 in the serial monitor, and press send, the code figures out which file on the SD card is #3, and plays that BY NAME.
You can play any track BY NAME, as long as you know the name.
I'm assuming that you know which track you want to play. As guix demonstrates, JUST DO IT.