If and or Statement - Unsure where i've gone wrong

Hey Guys,

First time posting here so apologies in advance if i’ve done something wrong here.

I’ve got my code posted below.

Basically, i’m trying to read from two PIR sensors and if either are tripped I want it to return and say it’s been tripped.

Currently the way the script is, the LED constantly reads a HIGH value and the blynk service i’m utilising gets flooded.

Any thoughts?

Thanks in advance,

/**************************************************************

**************************************************************/
//#define BLYNK_DEBUG
//#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>
char auth = “XXXXXXXXX”;

/* WiFi credentials */
char ssid = “XXXXXX”;
char pass = “XXXXX”;

#define ledPin D7
#define pirPin1 D1 // Input from PIR 1
#define pirPin2 D2 // Input from PIR 2

int pirValue1; // Place to store read PIR 1 Value
int pirValue2; // Place to store read PIR 2 Value

int pirState = LOW;
int val;

void setup()
{
Serial.begin(115200);
delay(10);
Blynk.begin(auth, ssid, pass);
pinMode(ledPin, OUTPUT);
pinMode(pirPin1, INPUT);
pinMode(pirPin2, INPUT);

}

void loop()
{
getPirValue();
Blynk.run();
}

void getPirValue(void)
{
pirValue1 = digitalRead(pirPin1);
pirValue2 = digitalRead(pirPin2);

if (pirValue1 == HIGH || pirValue2 == HIGH) {
digitalWrite(ledPin, HIGH);
Blynk.notify(“T==> Motion detected”);
if (pirState == LOW) {
Serial.println("==> Motion detected");
pirState = HIGH;
delay(10);
}
} else {
digitalWrite(ledPin, LOW); // turn LED OFF
//Blynk.notify(“T==> Motion ended”);
if (pirState == HIGH){
Serial.println(“Motion ended!”);
pirState = LOW;
}
}
}

The first thing you should do is look at the state change detection example. You want to tell Blynk when either PIR changes state, not what the states are every time through loop().

The STATE of the PIRs is stored in pirValue1 and pirValue2. pirState is a useless variable. Get rid of it.