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.