title: PIR Motion Sensor
body: <p>I have Arduino-UNO. My code is given below. Whenever I run the program, the PIR sensor triggers false highs. But, when the sensor and the jump wires are kept fixed at a point without moving, it reads perfectly.</p>
  <pre><code>int led = 13;
  int pin = 2;
  
  int value = 0;
  int pirState = LOW;
  
  void setup() {
   pinMode(led, OUTPUT);
   pinMode(pin, INPUT);
   Serial.begin(9600);
  }
  
  void loop() {
  
    value = digitalRead(pin);
  
    if (value == HIGH) {
      digitalWrite(led, HIGH);
  
    if (pirState == LOW) {
      Serial.println(&quot;Motion Detected!&quot;);
      pirState = HIGH;
      }
    }else{
      digitalWrite(led, LOW);
  
  if(pirState == HIGH){
    Serial.println(&quot;Motion Ended!&quot;);
    pirState = LOW;
    }
   }
  }
  </code></pre>
  <p>Here is my circuit:
  <img src="https://i.stack.imgur.com/Y0SZI.png" alt="picture of the circuit" /></p>