Security System with Arduino

Source Code:-

int sensor = 0;
int buzzer = 12;
int led = 13;
int Light = HIGH;

void setup() {
  pinMode (sensor, INPUT);
  pinMode (buzzer, OUTPUT);
  pinMode (led, OUTPUT);
}
 

void loop() {
  Light = digitalRead(sensor);
  if (Light== HIGH)
  {
    digitalWrite(buzzer, HIGH);
    digitalWrite(led,HIGH);
  }
  else
  {
    digitalWrite(buzzer, LOW);
    digitalWrite(led,LOW);
  }
  
}

 

Leave a Comment