Advertisement
Guest User

Untitled

a guest
Oct 1st, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.20 KB | None | 0 0
  1.  
  2. #define BLYNK_PRINT Serial
  3.  
  4.  
  5. #include <ESP8266_Lib.h>
  6. #include <BlynkSimpleShieldEsp8266.h>
  7. #include <RCSwitch.h>
  8. #include <SimpleTimer.h>
  9.  
  10. #define LEDGRUEN #7CFC00
  11. #define LEDROT #B22222
  12. #define LEDGRAU #808080
  13.  
  14. long signalCode;
  15.  
  16. byte vetlilkoerper1Stand = 0;
  17. byte vetlilkoerper1AltStand = 0;
  18. bool ventilkoerper1Gemeldet = false;    
  19. #define VERTILKOERPER1NAMEVPIN V1
  20. #define VENTILKOERPER1LEDVPIN V2
  21. #define VENTILKOERPER1MELUNGVPIN V3
  22.  
  23. byte vetlilkoerper2Stand = 0;
  24. byte vetlilkoerper2AltStand = 0;
  25. bool ventilkoerper2Gemeldet = false;  
  26. #define VERTILKOERPER2NAMEVPIN V4
  27. #define VENTILKOERPER2LEDVPIN V5
  28. #define VENTILKOERPER2MELUNGVPIN V6
  29.  
  30. byte nelaStand = 0;                     //lauft - 15932898  stoerung - 15932900
  31. byte nelaAltStand = 0;
  32. bool nelaGemeldet = false;
  33. #define NELANAMEVPIN V7
  34. #define NELALEDVPIN V8
  35. #define NELAMELUNGVPIN V9
  36.  
  37.  
  38. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  39. WidgetLED ventilkoperper1Led(VENTILKOERPER1LEDVPIN);
  40. WidgetLED ventilkoperper2Led(VENTILKOERPER2LEDVPIN);
  41. WidgetLED nelaLed(NELALEDVPIN);
  42.  
  43.  
  44.  
  45. SimpleTimer timer;
  46.  
  47. RCSwitch mySwitch = RCSwitch();
  48.  
  49.  
  50. char auth[] = "----------------------";
  51.  
  52.  
  53. char ssid[] = "BlynkServer";
  54. char pass[] = "1234567890";
  55.  
  56.  
  57. #define EspSerial Serial1
  58.  
  59. #define ESP8266_BAUD 115200
  60.  
  61. ESP8266 wifi(&EspSerial);
  62.  
  63. void setup()
  64. {
  65.  
  66.   Serial.begin(9600);
  67.  
  68.   mySwitch.enableReceive(0);  // Receiver on interrupt 0 => that is pin #2
  69.   EspSerial.begin(ESP8266_BAUD);
  70.   delay(10);
  71.  
  72.    timer.setInterval(5000, debuging);
  73.  
  74.  
  75.   Blynk.begin(auth, wifi, ssid, pass,"192.168.5.1", 8080);
  76. }
  77.  
  78. void loop()
  79. {
  80.   Blynk.run();
  81.   timer.run();
  82.  
  83.  
  84.     if (mySwitch.available()) {
  85.    
  86.     Serial.println( mySwitch.getReceivedValue() );
  87.     signalCode = mySwitch.getReceivedValue();
  88.     if(signalCode==15932898)
  89.     {nelaStand=1; Blynk.setProperty(NELALEDVPIN, "color", "#7CFC00"); nelaLed.on();}
  90.     if(signalCode==15932900){nelaStand=2; Blynk.setProperty(NELALEDVPIN, "color", "#B22222"); meldung();}
  91.  
  92.     mySwitch.resetAvailable();
  93.   }
  94.  
  95. }
  96.  
  97. void meldung()
  98. {
  99.  Blynk.notify("Nela steht! Überprüfen!");  
  100. }
  101.  
  102. void debuging()
  103. {
  104.    
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement