const int dormitorio1 = 2; //constante
const int dormitorio2 = 3; //constante
const int pir = 12;
const int buzzer = 14;
int lectura = 0; //variable
int sw = 0;
void setup() {
pinMode(dormitorio1, OUTPUT);
pinMode(dormitorio2, OUTPUT);
pinMode(pir, INPUT);
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
}

void loop() {
  lectura = digitalRead(pir);
  if(lectura == 1){
    digitalWrite(dormitorio1,1);
    digitalWrite(dormitorio2,1);
    digitalWrite(buzzer,1);
    sw = 1;
 }
 else{
    digitalWrite(dormitorio1,0);
    digitalWrite(dormitorio2,0);
    digitalWrite(buzzer,0);
     }
  if(sw == 1){
    Serial.println("Alarma! Intrusos en la casa");
    sw = 0;
    delay(5000); //Wokwi
    }
}
$abcdeabcde151015202530354045505560fghijfghij