Advertisement
Dani_info

weMos connect to Blynk

Apr 15th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. #include <Blynk.h>
  2.  
  3. #define BLYNK_PRINT Serial
  4.  
  5. #include <ESP8266WiFi.h>
  6.  
  7. #include <BlynkSimpleEsp8266.h>
  8.  
  9. // You should get Auth Token in the Blynk App.
  10.  
  11. // Go to the Project Settings (nut icon).
  12.  
  13. char auth[] = " ad9ca0799fff440c8d7d493dc9ae2168";
  14.  
  15. // Your WiFi credentials.
  16. // Set password to "" for open networks.
  17. char ssid[] = "DIGI-B02B";
  18. char pass[] = "4rhvxfkw";
  19.  
  20. int LED = D8; // Define LED as an Integer (whole numbers) and pin D8 on Wemos D1 Mini Pro
  21.  
  22. void setup()
  23. {
  24.   // Debug console
  25.   Serial.begin(115200);
  26.  pinMode(LED, OUTPUT); //Set the LED (D8) as an output
  27.   Blynk.begin(auth, ssid, pass);
  28.  
  29. }
  30.  
  31. void loop()
  32. {
  33.   Blynk.run();
  34.  
  35. }
  36.  
  37. // This function will be called every time button Widget
  38. // in Blynk app writes values to the Virtual Pin V3
  39. BLYNK_WRITE(V3) {
  40.  int pinValue = param.asInt(); // Assigning incoming value from pin V3 to a variable
  41.  if (pinValue == 1) {
  42.     digitalWrite(LED, HIGH); // Turn LED on.
  43.   } else {
  44.     digitalWrite(LED, LOW); // Turn LED off.
  45.  }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement