i am working on alarm project and i am using a magnetic sensor for door when the door is open the buzzer will HIGH, So now i want to override (bypass) the sensor using Botton, example once Button is on the sensor pin is need to disable.
i hope you hear me soon
Best Regard
Maaz
#define BLYNK_DEVICE_NAME "Device"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
#define APP_DEBUG
// Uncomment your board, or configure a custom board in Settings.h
#define USE_WROVER_BOARD
//#define USE_TTGO_T7
#include "BlynkEdgent.h"
bool alarm_mode = false ;
int ZONE1 = 32;
int buzzer = 22;
int botton = 2;
BlynkTimer timer;
void myTimerEvent(){
if(digitalRead(ZONE1) ==0){
Blynk.virtualWrite(V1,"CLOSE");
}
if(digitalRead(ZONE1) ==1){
Blynk.virtualWrite(V1,"OPEN");
if(alarm_mode == true){
digitalWrite(buzzer, HIGH);
}
}
}
BLYNK_WRITE(V2)
{
if ( param.asInt () == 1) // <------ ZONE1 BYPASS
{
digitalWrite(32,HIGH);
}
else
{
digitalWrite(32,LOW);
}
}
void setup()
{
pinMode(ZONE1,INPUT_PULLUP);
pinMode (botton,OUTPUT);
pinMode (buzzer,OUTPUT);
Serial.begin(115200);
delay(100);
BlynkEdgent.begin();
}
void loop() {
BlynkEdgent.run();
timer.run();
Blynk.run();
}