#define BLYNK_TEMPLATE_ID "TMPLqUGcc6I7"
#define BLYNK_TEMPLATE_NAME "AG IoT Switch"
#define BLYNK_AUTH_TOKEN "E73pXWQ2I23F7Al3HnZemyX6W97sSbTD"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <ESP32Servo.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
int angle;
int servoPin = 4;
Servo servo;
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin V4
BLYNK_WRITE(V3)
{
angle = param.asInt(); // Get value as integer
}
void setup()
{
// Debug console
Serial.begin(115200);
pinMode(5,OUTPUT);
Blynk.begin(auth, ssid, pass);
servo.attach(servoPin);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
servo.write(angle);
}