Hello ,
i try to get a notification when ir sensor be HIGH
i am sure that the sensor working fine
but there is no notification arrive to event or my phone
LED controlled via switch and its working good
anyone can help ?
here is my code :
#define BLYNK_TEMPLATE_ID "TMPL2ESqpobI"
#define BLYNK_TEMPLATE_NAME "PICOMonitor"
#define BLYNK_AUTH_TOKEN "1YQrEP7KnOXTH431nIj6t1Bnb9e-dcak"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "SAMSUNG Note9 WIFI"; // type your wifi name
char pass[] = "Kut19954321"; // type your wifi password
int ledPin = 12;
int IR_sensor_pin = 4;
BlynkTimer timer;
void sendSensor(){
int IR_sensor_value = digitalRead(IR_sensor_pin);
if (IR_sensor_value == HIGH) {
Blynk.logEvent("The Door Opened","Someone Enter to the room !");
Serial.print("Sensor:");
Serial.println(IR_sensor_value);
}
}
BLYNK_WRITE(V0) {
int pinValue = param.asInt();
digitalWrite(ledPin, pinValue);
Serial.print("V0:");
Serial.println(pinValue);
}
void setup(){
Serial.begin(115200);
Blynk.begin(auth, ssid, pass,"blynk.cloud",8080);
pinMode(IR_sensor_pin, INPUT);
pinMode(ledPin, OUTPUT);
timer.setInterval(2500L, sendSensor);
}
void loop(){
Blynk.run();
timer.run();
}