PIR Sensor Interfacing
with Arduino Uno
By Engr.Habib Ur Rehman
with Arduino Uno
By Engr.Habib Ur Rehman
Components/Equipment Required:
Following Components/Equipment are
required to perform task.
1.
Arduino
Uno (https://piees.pk/product/arduino-uno-r3/)
2.
PIR
Sensor (https://piees.pk/product/pir-sensor/)
3.
Buzzer/LED
Light
4.
Breadboard
5.
Jumper
Wires (https://piees.pk/product-category/jumper-wires/)
Circuit
Diagram:
Arduino Program:
int
PIR = 8;
int
LED = 13;
void
setup() {
pinMode(PIR, INPUT);
pinMode(LED, OUTPUT);
}
void
loop() {
int PIRValue = digitalRead(PIR);
if (PIRValue == 1) {
digitalWrite(LED, HIGH); // The Relay Input
works Inversly
delay(100);
digitalWrite(LED, LOW); // The Relay Input
works Inversly
}
if (PIRValue == 0) {
digitalWrite(LED, LOW); // The Relay Input
works Inversly
}}
No comments:
Post a Comment