Skip to content

Instantly share code, notes, and snippets.

@yemreeke
Created December 19, 2020 10:57
Show Gist options
  • Save yemreeke/19fa94ae255cd6abf3c921326485114e to your computer and use it in GitHub Desktop.
Save yemreeke/19fa94ae255cd6abf3c921326485114e to your computer and use it in GitHub Desktop.
int LedPin=7,PirPin=8;
int BuzzerPin=9,Hareket;
void setup() {
pinMode(BuzzerPin,OUTPUT);
pinMode(LedPin,OUTPUT);
pinMode(PirPin,INPUT);
}
void loop() {
Hareket = digitalRead(PirPin); //Değer Okuduk
if(Hareket==HIGH){ //Hareket Var ise
digitalWrite(LedPin,HIGH);//Led Açıldı
tone(BuzzerPin, 660); //Kapı Zili
delay(700); //Açıldı
tone(BuzzerPin, 550);
delay(700);
tone(BuzzerPin, 440); //Kapı Zili
delay(700); //Kapandı
noTone(BuzzerPin);
digitalWrite(LedPin,LOW);//Led Kapandı
}
delay(500); // 0.5 sn bekle
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment