Motion Dedect on relay

Hi the relay works when the motion is detected but the information message always comes up. Where do I make a mistake? When the motion I want is detected, both relay and message should be sent.


#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
int pirPin = 01;
int relayPin = D2;
int pirValue;

char auth[] = "929d993bb56d4b4a82e52225f0f4fe72";
char ssid[] = "okhan";
char pass[] = "atakan2009";

void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  pinMode(pirPin, INPUT);
  pinMode(relayPin, OUTPUT);
}

void pirSensor()
{
  pirValue = digitalRead(pirPin);
  Blynk.virtualWrite(V11, pirValue);
}

void loop()
{
  Blynk.run();
  pirSensor();
  if (pirValue == HIGH)
  {
    digitalWrite(relayPin, LOW);
    
  }
  
  else


  digitalWrite(relayPin, HIGH);{ 
   Blynk.notify("Hello");
  }
 
}

Same as in your other topics… You need to read the documentation and learn how to code with timers instead of running everything in the void loop()

the notification widget has time limitations requiring timers and logic flags…

Limitations:

* Maximum allowed body length is 120 symbols;
* Every device can send only 1 notification every 5 seconds;

Please don’t keep making new topics asking for us to troubleshoot or fix your code for you… particularly since you haven’t followed up on many of the past topics as it is… it is hard to see if you are actually following to anything we guide you on.