Hello, I’m new to the community, I have a project with the pir sensor and the WEMOS D1mini, when using Blynk.notify I don’t receive any alerts on my device, I don’t know what I’m doing wrong, I appreciate any collaboration, greetings from Colombia, this is the code.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "xxxx";
char ssid[] = "xxxxxx";
char pass[] = "xxxxx";
BlynkTimer timer;
int pinValue = 0;
#define PIR D3
#define relay1 D1
void setup() {
Serial.begin(9600);
pinMode(D1, OUTPUT);
digitalWrite(D3, LOW);
digitalWrite (D1, LOW);
delay(20000);
Blynk.begin(auth, ssid, pass,"blynk.cloud", 80);
timer.setInterval(1000L, notifiaction);
}
BLYNK_WRITE(V0) {
pinValue = param.asInt();
}
void notifiaction() {
bool sensor = digitalRead(D3);
Serial.println(sensor);
if (pinValue == 1) {
Serial.println("System is ON");
if (sensor == 1) {
Blynk.notify ("MOTION detect!!!");
digitalWrite(D1, HIGH);
delay(10000);
} else if (sensor == 0) {
digitalWrite(D1, LOW);
delay(50);
}
} else if (pinValue == 0) {
Serial.println("System is OFF");
}
}
//Get buttons values
BLYNK_WRITE(V5) {
bool RelayOne = param.asInt();
if (RelayOne == 1) {
digitalWrite(relay1, LOW);
} else {
digitalWrite(relay1, HIGH);
}
}
void loop() {
Blynk.run();
timer.run();
}