Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 703 Bytes

Basic - Security System2.md

File metadata and controls

41 lines (32 loc) · 703 Bytes

Basic - Security System using PIR Sensor


Circuit Diagram


Arduino Code:

int pir_pin = 2;
int led_pin = 3;
int buzzer_pin = 4;
void setup()
{
 pinMode(pir_pin, INPUT);
 pinMode(led_pin, OUTPUT);
 pinMode(buzzer_pin, OUTPUT);
 Serial.begin(9600);
}

void loop()
{
  if(digitalRead(pir_pin) == HIGH)
   {
  	digitalWrite(led_pin, HIGH);
    digitalWrite(buzzer_pin, HIGH);
    Serial.println("Detectado");
   }
   else{
    digitalWrite(led_pin, LOW);
    digitalWrite(buzzer_pin, LOW);
    Serial.println("No Detectado");
   }
}