Skip to content

Instantly share code, notes, and snippets.

@yemreeke
Created December 10, 2020 08:14
Show Gist options
  • Save yemreeke/5772503bfe3d6f2c293f45e13cb81b25 to your computer and use it in GitHub Desktop.
Save yemreeke/5772503bfe3d6f2c293f45e13cb81b25 to your computer and use it in GitHub Desktop.
int BuzzerPin=9;
int Led=8;
int LDR_Deger=0;
void setup(){
pinMode(BuzzerPin,OUTPUT);
pinMode(Led,OUTPUT);
pinMode(A0,INPUT);
}
void loop(){
LDR_Deger=analogRead(A0);//LDR Değer Okuduk
if(LDR_Deger<300){ //300'den küçükse
digitalWrite(Led,HIGH); //Led Yak
digitalWrite(BuzzerPin,HIGH); //Buzzer Aç
}
else{ //Büyükse kapat
digitalWrite(Led,LOW);
digitalWrite(BuzzerPin,LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment