Created
March 2, 2024 23:04
-
-
Save Ajak58a/899065378f6aaf2a90eb338d94cc91af to your computer and use it in GitHub Desktop.
DIY Circuit Home Security System: Dog-Inspired Motion Detection System
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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