int LED = 13;
int Input_PIR = 15;
int Sensor_PIR = LOW;
int val = 0;
void setup()
{
pinMode(LED, OUTPUT);
pinMode(Input_PIR, INPUT);
Serial.begin(9600);
}
void loop()
{
val = digitalRead(Input_PIR);
if (val == HIGH)
{
digitalWrite(LED, HIGH);
if (Sensor_PIR == LOW)
{
Serial.println("Motion Detected!");
Sensor_PIR = HIGH;
}
} else {
digitalWrite(LED, LOW);
if (Sensor_PIR == HIGH) {
Serial.println("No Movement!");
Sensor_PIR = LOW;
}
}
}