tum_yil_icin_arduino_mufredati_16
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
int pirPin = 3; // PIR pin | |
int ledPin = 4; // LED pin | |
int deger = 0; | |
void setup() { | |
pinMode(pirPin, INPUT); // PIR Pin'i giriş yapılıyor | |
pinMode(ledPin, OUTPUT); // LED Pin'i çıkış yapılıyor | |
Serial.begin(9600); //Serial Porttan veri göndermek için | |
//baundrate(9600(veri gönderim hızı)) ayarlanıyor. | |
} | |
void loop(){ | |
deger = digitalRead(pirPin); // Dijital pin okunuyor | |
Serial.println(deger); // Okunan değer seri porttan okunuyor. | |
if (deger == HIGH) { | |
digitalWrite(ledPin, HIGH); // Eğer okunan değer 1 ise LED yakılıyor. | |
} | |
else{ | |
digitalWrite(ledPin,LOW); // Eğer okunan değer 0 ise LED söndürülüyor. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment