PIR sensor issue

Hello, i'm using two PIR sensor with arduino uno i have made sensors pin as input like

pinMode(inputPin1, INPUT); // declare sensor as input
pinMode(inputPin2, INPUT); // declare sensor as input

as soon as obstacle comes this sensor goes high but how can i made this sensor pin low again after it turn high by obstacle using software code.

as pins are input can i write to this pin?

Why would it stay high? When you read a pin, you get the current state of the input. If the input went low, you will read a low.

Actually sir,when one time pir value high it stays high for some time 2 min approx that is creating problem.

Please post a link to, or an image of your sensor. Most have a pot for adjusting the length of time the output remains high. Regardless, it is possible via instructions in your sketch to detect when the PIR output has gone high and set a variable. You can then do what you wish with that variable.

Please explain why the output pin remaining high is creating a problem.

  • Scotty

ankushg989: Actually sir,when one time pir value high it stays high for some time 2 min approx that is creating problem.

Then you write code to detect a low to high transition, instead of just looking at the state. As Scotty says, you can do it with a variable.

Sir, how to do that?

Look this over. Replace the word 'button' with 'PIR' to make the sketch more fitting to your request. At the beginning of the sketch, before Setup, declare a boolean variable called 'detected' (or whatever you choose) and initialized it to false. In the Loop, somewhere within the 'if (buttonState == HIGH) {' statement (perhaps before 'Serial.println("on");', insert 'detected = true;'. There, you now have a variable called 'detected' set to true and you can do with it what you wish. - Scotty