Advertisement
Siklosi_Csapda

Untitled

Jan 11th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.43 KB | None | 0 0
  1.  
  2.  
  3. /* Comment this out to disable prints and save space */
  4. #define BLYNK_PRINT Serial
  5. /* Set this to a bigger number, to enable sending longer messages */
  6. //#define BLYNK_MAX_SENDBYTES 128
  7.  
  8. #include <ESP8266WiFi.h>
  9. #include <BlynkSimpleEsp8266.h>
  10.  
  11. // You should get Auth Token in the Blynk App.
  12. // Go to the Project Settings (nut icon).
  13. char auth[] = " e896fc9de640471f95048eaf7e29845c";
  14.  
  15. // Your WiFi credentials.
  16. // Set password to "" for open networks.
  17. char ssid[] = "DIGI-01061597";
  18. char pass[] = "PMzvSJDW";
  19.  
  20. void emailOnButtonPress()
  21. {
  22. // kazán hiba esemény
  23. if (digitalRead(D1)==LOW)
  24.   {
  25.     delay(5);
  26.    if (digitalRead(D1)==LOW){
  27.     Serial.println("Button is pressed."); // This can be seen in the Serial Monitor
  28.    
  29.    
  30.     Blynk.email("felugyelo_kaz@gmail.hu", "Alkony utca", "Kazán hiba!");
  31. //eventor
  32.     Blynk.virtualWrite(V1, 1);
  33.   }
  34.    } else {
  35.     Blynk.virtualWrite(V1, 0);
  36.   }
  37.   //eventor!
  38.   //kazán hiba esemény
  39.  
  40.  //alacsony víznyomás esemény
  41.  if (digitalRead(D2)==LOW)
  42.   {
  43.     delay(5);
  44.    if (digitalRead(D2)==LOW){
  45.     Serial.println("Button is pressed."); // This can be seen in the Serial Monitor
  46.    
  47.    
  48.     Blynk.email("felugyelo_kaz@gmail.hu", "Alkony utca", "Alacsony víznyomás");
  49. //eventor
  50.     Blynk.virtualWrite(V0, 1);
  51.   }
  52.    } else {
  53.     Blynk.virtualWrite(V0, 0);
  54.   }
  55.   Serial.println("V0");
  56.     Serial.println(V0);
  57.  
  58.   //eventor
  59.   //alacsony víznyomás esemény!
  60.  
  61.  
  62.     // Or, if you want to use the email specified in the App (like for App Export):
  63.     //Blynk.email("Subject: Button Logger", "You just pushed the button...");
  64.   }
  65.  
  66.  
  67. void setup()
  68. {
  69.   pinMode(D1, INPUT);
  70.  digitalWrite(D1,HIGH);
  71.   pinMode(D2, INPUT);
  72.   digitalWrite(D2,HIGH);
  73.   // Debug console
  74.   Serial.begin(9600);
  75.  
  76.   Blynk.begin(auth, ssid, pass);
  77.   // You can also specify server:
  78.   //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  79.   //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
  80.  
  81.   // Send e-mail when your hardware gets connected to Blynk Server
  82.   // Just put the recepient's "e-mail address", "Subject" and the "message body"
  83.   Blynk.email("felugyelo_kaz@gmail.hu", "Subject", "My Blynk project is online.");
  84.  
  85.   // Setting the button
  86.  // pinMode(2, INPUT_PULLUP);
  87.  
  88.   // Attach pin 2 interrupt to our handler
  89.   attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE);
  90. }
  91.  
  92. void loop()
  93. {
  94.   Blynk.run();
  95.   emailOnButtonPress();
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement