Advertisement
andretafta

Blynk + Servo

Aug 24th, 2020 (edited)
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define BLYNK_PRINT Serial
  2.  
  3.  
  4. #include <ESP8266WiFi.h>
  5. #include <BlynkSimpleEsp8266.h>
  6. #include <Servo.h>
  7.  
  8. // You should get Auth Token in the Blynk App.
  9. // Go to the Project Settings (nut icon).
  10. char auth[] = "YourAuthToken";
  11.  
  12. // Your WiFi credentials.
  13. // Set password to "" for open networks.
  14. char ssid[] = "YourNetworkName";
  15. char pass[] = "YourPassword";
  16.  
  17. Servo servo;
  18.  
  19. BLYNK_WRITE(V3)
  20. {
  21.   servo.write(param.asInt());
  22. }
  23.  
  24. void setup()
  25. {
  26.   // Debug console
  27.   Serial.begin(9600);
  28.  
  29.   Blynk.begin(auth, ssid, pass);
  30.   // You can also specify server:
  31.   //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  32.   //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
  33.  
  34.   servo.attach(2);
  35. }
  36.  
  37. void loop()
  38. {
  39.   Blynk.run();
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement