Make an MP3 board immediately play a track

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?

FilePlayer.ino (23.8 KB)

Look at the documentation of the library, also look at the sketch you are using

http://mpflaga.github.io/Sparkfun-MP3-Player-Shield-Arduino-Library/class_s_f_e_m_p3_shield.html

You want to use methods playMP3 and setVolume.

guix:
Look at the documentation of the library, also look at the sketch you are using

SFEMP3Shield: SFEMP3Shield Class Reference

You want to use methods playMP3 and setVolume.

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?

I'm still very new to coding

Where in the code would I put that?

Wherever you want the track to start playing.

Also how do I know the file name? Is it just the actual file name (track001.mp3) or does the microSD read it differently?

When you send a number, n, via the serial port, the current code plays the nth track on the card.

If you want to play some specific file, don't worry about which track it is. Just specify its name.

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.

Something like this

void setup()
{
  MP3player.begin();
  MP3player.playMP3( "track001.mp3" );
}

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.

This is the error I'm getting:

exit status 1
'track001' was not declared in this scope

The file's name is track001.mp3 (so I typed MP3player.playMP3(track001.mp3)) because that's what the example code says to name the files.

If I type in 001 or just 1 into MP3player.playMP3();, this is the error that I get:

exit status 1
invalid conversion from 'int' to 'char*' [-fpermissive]

The file's name is track001.mp3

The file name needs to be in quotes, since the function expects a string.

Now it uploads, but it doesn't play

Now it uploads, but it doesn't play

What does?