Circuit Diagram:
Code:
#include <SD.h>
//#define SD_ChipSelectPin 53
#define SD_ChipSelectPin 10
#include <TMRpcm.h>
#include <SPI.h>
TMRpcm tmrpcm;
void setup()
{
tmrpcm.speakerPin=9;
Serial.begin(9600);
if(!SD.begin(SD_ChipSelectPin))
{
Serial.println(“SD fail”);
return;
}
tmrpcm.setVolume(6);
tmrpcm.play(“gun.wav”);
}
void loop()
{
}