Last active
December 13, 2020 15:56
-
-
Save yemreeke/1a3eb143dbd170fd753bf1d64e22dc48 to your computer and use it in GitHub Desktop.
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 <IRremote.h> | |
int BuzzerPin=9,Led1=8; | |
int Led2=7,Buton=6,control=0; | |
IRrecv irrecv(4); | |
decode_results results; | |
#define PowerTUS 0x1CE3F00F | |
void setup(){ | |
irrecv.enableIRIn(); | |
pinMode(BuzzerPin,OUTPUT); | |
pinMode(Led1,OUTPUT); | |
pinMode(Led2,OUTPUT); | |
pinMode(Buton,INPUT); | |
pinMode(A0,INPUT); | |
} | |
void loop(){ | |
if(analogRead(A0)<300)//LDR 300'den küçükse | |
control=1; //Hırsız var | |
if(digitalRead(Buton)==1)//Butona tıklayınca | |
control=0; //Alarmı kapat | |
if (irrecv.decode(&results)){ | |
if(results.value==PowerTUS)//POWER Basılırsa | |
control=0; //Alarm Kapat | |
irrecv.resume(); | |
} | |
if(control==1){ //Alarmı Aç | |
digitalWrite(Led1,HIGH); | |
digitalWrite(BuzzerPin,HIGH); | |
digitalWrite(Led2,LOW); | |
} | |
else{ //Alarmı Kapat | |
digitalWrite(Led1,LOW); | |
digitalWrite(BuzzerPin,LOW); | |
digitalWrite(Led2,HIGH); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment