#include <SD.h>
#include <SPI.h> 
#define SD_ChipSelectPin 10  //using digital pin 10 on arduino uno
#include <TMRpcm.h>          // Library for audio play from SDcard
 
TMRpcm tmrpcm;   // Object to access library functions

void setup(){
 
  tmrpcm.speakerPin = 9; //PWM pin 9 on Uno
  Serial.begin(9600);    //Begin Arduino serial monitor
  //Check card presence 
  if (!SD.begin(SD_ChipSelectPin)) {  
  Serial.println("Unable to read SD card");
  return;                    // Wait here until SD card detected
  }
 tmrpcm.volume(2);          //Sets the volume - PWM width
 delay(60000); //1 minute delay to give you time to lock the door
}
 
void loop(){  
  
  if(digitalRead(5)){  //motion detected
    tmrpcm.play("bark.wav");
    delay(5000);
  }
}