int PIR=2;
int val=0;
void setup() {
// put your setup code here, to run once:
pinMode(PIR, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
val=digitalRead(PIR);
if(val == HIGH){
Serial.println("motion detected");
} else{
Serial.println("motion stoped");
}
delay(1000);
}