//Inisialisasi pin
int ledPin = 13;
int inputPin = A0;
int pinState = LOW;
int val = 0;

void setup ()
{
  pinMode (ledPin, OUTPUT);
  pinMode (inputPin, INPUT);
  Serial.begin(9600);
}

void loop ()
{
  val = digitalRead (inputPin);

  if (val == HIGH)
  {
    digitalWrite(ledPin, HIGH);
    if (pinState == HIGH) {
      Serial.println("Gerakan Terdeteksi!");
      pinState = LOW;
    }
  }
else
{
  digitalWrite(ledPin, LOW);
  if (pinState == LOW){
    Serial.println("Tidak Ada Gerakan!");
    pinState = HIGH;
  }
}
}
$abcdeabcde151015202530fghijfghij