Problem uploading

The following code is for Sparkfun's Lilypad mp3 an atmega 328 running at 3.3 volts and 8Mhz powered Arduino based mp3 player. the code pulls the mp3 files from an SD card (files named 1.mp3, 2.mp3 etc) and plays them when one of 5 trigger pins are pulled low. the code is setup to randomly play up to 12 mp3 files when trigger pi 1 is pulled low by a pir sensor. right now it is playing randomly with out being triggered.

// "Trigger" example sketch for Lilypad MP3 Player Modified

// 1.0 initial release MDG 2012/11/01

// We'll need a few libraries to access all this hardware!

#include <SPI.h> // To talk to the SD card and MP3 chip
#include <SdFat.h> // SD card file system
#include <SFEMP3Shield.h> // MP3 decoder chip

// And a few outputs we'll be using:

const int ROT_LEDR = 10; // Red LED in rotary encoder (optional)
const int EN_GPIO1 = A2; // Amp enable + MIDI/MP3 mode select
const int SD_CS = 9; // Chip Select for SD card

// Create library objects:

SFEMP3Shield MP3player;
SdFat sd;

// We'll store the five filenames as arrays of characters.
// "Short" (8.3) filenames are used, followed by a null character.

char filename[12][13]; //This is for 12 sound files

int pirPin = A0; //the pin where we read the val of the motsen
int pirVal; //stores the value (hi or lo) for the motion sensor

unsigned long time1;
unsigned long time2;

void setup()
{

time1 = millis();
pinMode(pirPin, INPUT);

int x, index;
SdFile file;
byte result;
char tempfilename[13];

// The board uses a single I/O pin to select the
// mode the MP3 chip will start up in (MP3 or MIDI),
// and to enable/disable the amplifier chip:

pinMode(EN_GPIO1,OUTPUT);
digitalWrite(EN_GPIO1,LOW); // MP3 mode / amp off

// Initialize the SD card; SS = pin 9, half speed at first

sd.begin(SD_CS, SPI_HALF_SPEED); // 1 for success

// Start up the MP3 library

MP3player.begin(); // 0 or 6 for success

// Now we'll access the SD card to look for any (audio) files
// starting with the characters '1' to '5':

// if (debugging) Serial.println(F("reading root directory"));

// Start at the first file in root and step through all of them:

sd.chdir("/",true);
while (file.openNext(sd.vwd(),O_READ))
{
// get filename

file.getFilename(tempfilename);

// Does the filename start with char '1' through '5'?

index = tempfilename[0] - '1';

// Copy the data to our filename array.

strcpy(filename[index],tempfilename);

file.close();
}

// Set the VS1053 volume. 0 is loudest, 255 is lowest (off):

MP3player.setVolume(10,10);

// Turn on the amplifier chip:

digitalWrite(EN_GPIO1,HIGH);
delay(2);
}

void loop()
{

int t; // current trigger
static int last_t; // previous (playing) trigger
int x;
byte result;

time2 = millis();

if((time2 - time1)>=1000){
pirVal = digitalRead(pirPin);
time1 = time2;
}

t = 3;

if(pirVal == HIGH){
MP3player.playMP3(filename[random(0,11)]);
delay(5000);
}
}