PIR output stays low or stays high

Hey everyone,

I am having some strange issues with my PIR I am using for my school project (using an esp8266).
I will first show some images of my setup.



The issue I am having is that it worked in the beginning, but when I opened my laptop today and wanted to continue to work on it, the digitalRead gives either high or low and stays at the same state forever.

Here is my code:

int inputPin = D7;              // input pin for the motion sensor
int val = 0;                    // variable for reading the pin status

void setup() {
  Serial.begin(9600);
  pinMode(inputPin, INPUT);     // declare sensor as input
 }
 
void loop(){
  val = digitalRead(inputPin);
  Serial.println(val);
  delay(1000);
  }

It either stays at 0 all time, or stays at 1 all the time depending on what the first value was. I really don't know what's going on so maybe anyone else here knows how I can solve this issue.

It solved by switching the D7 to D8, does anyone know why? I have had this issue for a few times now and really don't know how this is happening.

remcobravenboer:
It solved by switching the D7 to D8, does anyone know why? I have had this issue for a few times now and really don't know how this is happening.

Is it always a different pin and none that quit ever work again?

If so, chances are that your circuit is letting a bit too much current in or out of the pin. The damage takes time to complete.