top of page
Search
Writer's pictureMein-bhi-Engineer

BURGLAR ALARM SYSTEM

Updated: Aug 6, 2022

PIR sensors allow you to sense motion, almost always used to detect whether a human has moved in or out of the sensors range. They are small, inexpensive, low-power, easy to use and don't wear out. For that reason, they are commonly found in appliances and gadgets used in homes or businesses. They are often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors.


CIRCUIT DIAGRAM





CODE


int led = 3;
int pin = 13;
int value = 0;
int pirState = LOW;

void setup() 
{
  pinMode(led, OUTPUT);
  pinMode(pin, INPUT);
  Serial.begin(9600);
}

void loop()
 {

  value = digitalRead(pin);

  if (value == HIGH) 
{
    digitalWrite(led, HIGH);

    if (pirState == LOW) 
{
      Serial.println("ZOMBIE ATTACK!!!!!!!");
      pirState= HIGH;
    }
  }
else
{
    digitalWrite(led, LOW);

    if(pirState == HIGH)
{
      Serial.println("OHH CHILLAX, THAT'S M");
      pirState = LOW;
      }
    }
}



23 views0 comments

Recent Posts

See All

Comments


bottom of page