int PIR = 4;
int statusPin = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(PIR, INPUT);
}
void loop()
// put your main code here, to run repeatedly:
{
statusPin = digitalRead(PIR);
if (statusPin == HIGH)
{
Serial.println("Gerakan terdeteksi");
}
else
{
Serial.println("Tidak ada gerakan");
}
}