Open full view…

home security

Wed, 01 Mar 2017 15:59:24 GMT

hi i would like to ask some question, 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 ALARM_PIN = 15; const int MAGNETIC_SWITCH_PIN = 12; void setup() { pinMode(ALARM_PIN, OUTPUT); pinMode(MAGNETIC_SWITCH_PIN, INPUT); digitalWrite(ALARM_PIN, LOW); Serial.begin(9600); Blynk.begin(auth, ssid, pass); } void loop() {; bool switchState = digitalRead(MAGNETIC_SWITCH_PIN); if (!switchState) { Blynk.notify("alert intruders at your house"); digitalWrite(ALARM_PIN, HIGH); delay(5000); Serial.println("HIGH"); } else { digitalWrite(ALARM_PIN, LOW); Serial.println("LOW"); } }