Skip to content

Instantly share code, notes, and snippets.

@Ajak58a
Created March 2, 2024 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ajak58a/899065378f6aaf2a90eb338d94cc91af to your computer and use it in GitHub Desktop.
Save Ajak58a/899065378f6aaf2a90eb338d94cc91af to your computer and use it in GitHub Desktop.
DIY Circuit Home Security System: Dog-Inspired Motion Detection System
#include <TMRpcm.h> // Library for audio play from SDcard
#include <pcmConfig.h>
#include <pcmRF.h>
#include <SD.h>
#include <SPI.h>
#define SD_ChipSelectPin 10 //using digital pin 10 on arduino uno
TMRpcm tmrpcm;
void setup() {
tmrpcm.speakerPin=9; //PWM pin 9 on Uno
Serial.begin(9600); //Begin Arduino serial monitor
//Check card presence
if(!SD.begin(10)){
Serial.println("unable to read SD card");
return; // Wait here until SD card detected
}
tmrpcm.volume(5); //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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment