hi i would like to ask some question this group, and your advice,how to use the button from BLYNK connect to ESPRESSO which is want to ON/OFF function using manual remotely apps BLYNK
EXAMPLE :
the magnetic switch open (button BLYNK ON) then alarm trigger and get the notification, when the magnetic switch close (BUTTON OFF) the alarm and notification not function.
this is my coding hopefully can help me.
onegaishimasu
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = " ";
char ssid[] = " ";
char pass[] = " ";
const int ALARMPIN = 15;
const int MAGNETICSWITCHPIN = 12;
void setup() {
pinMode(ALARMPIN, OUTPUT);
pinMode(MAGNETICSWITCHPIN, INPUT);
digitalWrite(ALARMPIN, LOW);
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop() {
Blynk.run();
bool switchState = digitalRead(MAGNETICSWITCHPIN);
if (!switchState) {
Blynk.notify(”alert intruders at your house“);
digitalWrite(ALARMPIN, HIGH);
delay(5000);
Serial.println(”HIGH“);
}
else {
digitalWrite(ALARM_PIN, LOW);
Serial.println("LOW");
}
}