int pirPin = 6;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(pirPin, INPUT); // Matikan buzzer pada awalnya
}
void loop() {
// put your main code here, to run repeatedly:
int motionDetected = digitalRead(pirPin); // Baca status sensor PIR
Serial.println(motionDetected);
if (motionDetected == HIGH) {
// Sensor PIR mendeteksi gerakan, aktifkan buzzer
Serial.println("Tamu masuk!");
}
}