PIR sensor MP3 shield

Hi,I am new to arduino and have no experince in c programming,my project involves an motion sensor detecting motion and activating the MP3 shield to ply a random track through the Arduino UNO,I have compiled codes I have found online together,I got the hardware together I just need help in software area.

#include <SdFat.h>
#include <SdFatUtil.h>
#include <SPI.h>
#include <SFEMP3Shield.h>
SFEMP3Shield MP3player;

// constant variables

int pirPin = 5; // PIR sensor input pin
int calibrationTime = 10;
unsigned long playTime = 15000; // how long a file will play in milliseconds (15000=15 seconds)
unsigned long pauseTime = 10000; // how long the pause will be after the sound ends (10000=10 seconds)
int readingInterval = 20; // how often to read the sensor

// changing variables

int rantrack = 0; // track number for randomizing
unsigned long currentMillis = 0; // time variable to track running time: current time
unsigned long startingMillis = 0; // time variable to track running time: starting time
byte result; // variable for mp3 player shield, can be used to debug

// setup

void setup() {
pinMode(pirPin, INPUT);
digitalWrite(pirPin, LOW);

//give the sensor some time to calibrate
for(int i = 0; i < calibrationTime; i++){
delay(1000);
}
delay(50);

pinMode(pirPin, INPUT); // make PIR sensor an input
digitalWrite(pirPin, LOW); // activate internal pull-up resistor
result = MP3player.begin(); // start mp3 player shield
MP3player.SetVolume(10, 10); // set volume of the mp3 player ( 0 = loudest )
}
// loop

void loop(){
if (digitalRead(pirPin)== HIGH) { // if movement sensed
randomSeed(millis()); // set a more random seed for the random function
rantrack = random(55); // find random number
result = MP3player.playTrack(rantrack); // play track
playtime(); // call function for play time
MP3player.stopTrack(); // stop track
delay(pauseTime); // wait...
}

delay(readingInterval); // wait with reading
}

// function to determine playtime

void playtime() {
startingMillis = millis(); // set both time counter
currentMillis = millis();
while ( currentMillis - startingMillis < playTime ) { // while track plays, runs until playTime is reached
currentMillis = millis(); // set to actual time
delay(40); // debounce
}
}

this is the code i have compiled to randomly play any track when motion is detected,all of it i found online!:smiley:
now i am going to name the tracks in the SD card track000.mp3 and etc. The problem i am having is where do i change in the code for these names?? I got the libraries online.
I am on a deadline and a prompt answer is very much appreciated
Thanks ,Newbie

Please you code tags (#) they work wonders for everyone!
Here see if this helps, it's rather detailed.
http://garagelab.com/m/blogpost?id=6484258%3ABlogPost%3A5856

ive downloaded the SDFIle,but when i extract everything i cant find the Sd2PinMap.h file??

The code compiler successfully but there is no sound playing!how long must I w8 for the sensor to calibrate itself?

Maybe it has an internal volume that has to be set.

I've set the volume and everything,I've changed the chip select from 10 to 9,and the code uploads fine but it cannot ply.!!

Does it know what your tracks are labeled, because it takes a certain format like track001 ,002 ,003 and so on. Some have different formats but it is relatively the same.

I only uploaded one track to tr SD card to test it out first,I've made the changes in te code ran track from 55 to 1 and I named it track001.mp3

Maybe the track itself needs to be named track1.where did you get your mp3 shield, it may need its own code and not a generic code from on line. You need to find everything you can about your mp3 shield.

If you have a link to your shield and ITS code post it.

All tutorial I've read states that the track should be named track000.mp3-tracknnn.mp3
The mp3 shield is from sparkfun electronics MP3 shield

Try a more minimal sketch until you get things going: in setup, just call the begin method on the MP3player object, serial print the return value and then call playMP3 with the filename of your track. Print the return value of this function too. In loop, do nothing. What happens now?

take a look at this code, Dont use it but look how it is written, how it calls a track, the volume,etc...

http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Shields/MP3_Player_Example_Control.pde