int led = 12 ;
int buzzer = 11 ;
int pir = 13 ;
int nilai ;
void setup() {
   pinMode (led, OUTPUT);
   pinMode (buzzer,OUTPUT);
   pinMode (pir, INPUT);
   Serial.begin(9600);

}

void loop() {
   nilai = digitalRead(pir);
   
if (nilai==HIGH){
   digitalWrite(led,HIGH);
   tone(buzzer,1000);
   Serial.print(" Terdeteksi ");
}
else {
   digitalWrite(led,LOW);
   noTone(buzzer);
   Serial.print(" Tidak Terdeteksi ");
}
}