int pirPin = 2;
int ledPin = 13;
int state;
void setup() {
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop(){
state = digitalRead(pirPin);
Serial.println(state);
if (state == HIGH){
digitalWrite(ledPin, HIGH);
}
else{
digitalWrite(ledPin,LOW);
}
}