int PIR = 2; // choose the input pin (for PIR sensor)
int val = 0; // variable for reading the pin status
#define LED 5
void setup() {
Serial.begin(9600);
pinMode(PIR, INPUT); // declare sensor as input
pinMode(LED, OUTPUT);
}
void loop() {
val = digitalRead(PIR); // read input value
Serial.println(val);
if (val == 0)
digitalWrite(LED, LOW);
else
digitalWrite(LED, HIGH);
delay(1000);
}