Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Comment this out to disable prints and save space */
- #define BLYNK_PRINT Serial
- /* Set this to a bigger number, to enable sending longer messages */
- //#define BLYNK_MAX_SENDBYTES 128
- #include <ESP8266WiFi.h>
- #include <BlynkSimpleEsp8266.h>
- // You should get Auth Token in the Blynk App.
- // Go to the Project Settings (nut icon).
- char auth[] = " e896fc9de640471f95048eaf7e29845c";
- // Your WiFi credentials.
- // Set password to "" for open networks.
- char ssid[] = "DIGI-01061597";
- char pass[] = "PMzvSJDW";
- void emailOnButtonPress()
- {
- // kazán hiba esemény
- if (digitalRead(D1)==LOW)
- {
- delay(5);
- if (digitalRead(D1)==LOW){
- Serial.println("Button is pressed."); // This can be seen in the Serial Monitor
- Blynk.email("felugyelo_kaz@gmail.hu", "Alkony utca", "Kazán hiba!");
- //eventor
- Blynk.virtualWrite(V1, 1);
- }
- } else {
- Blynk.virtualWrite(V1, 0);
- }
- //eventor!
- //kazán hiba esemény
- //alacsony víznyomás esemény
- if (digitalRead(D2)==LOW)
- {
- delay(5);
- if (digitalRead(D2)==LOW){
- Serial.println("Button is pressed."); // This can be seen in the Serial Monitor
- Blynk.email("felugyelo_kaz@gmail.hu", "Alkony utca", "Alacsony víznyomás");
- //eventor
- Blynk.virtualWrite(V0, 1);
- }
- } else {
- Blynk.virtualWrite(V0, 0);
- }
- Serial.println("V0");
- Serial.println(V0);
- //eventor
- //alacsony víznyomás esemény!
- // Or, if you want to use the email specified in the App (like for App Export):
- //Blynk.email("Subject: Button Logger", "You just pushed the button...");
- }
- void setup()
- {
- pinMode(D1, INPUT);
- digitalWrite(D1,HIGH);
- pinMode(D2, INPUT);
- digitalWrite(D2,HIGH);
- // Debug console
- Serial.begin(9600);
- Blynk.begin(auth, ssid, pass);
- // You can also specify server:
- //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
- //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
- // Send e-mail when your hardware gets connected to Blynk Server
- // Just put the recepient's "e-mail address", "Subject" and the "message body"
- Blynk.email("felugyelo_kaz@gmail.hu", "Subject", "My Blynk project is online.");
- // Setting the button
- // pinMode(2, INPUT_PULLUP);
- // Attach pin 2 interrupt to our handler
- attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE);
- }
- void loop()
- {
- Blynk.run();
- emailOnButtonPress();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement