#define BLYNK_TEMPLATE_ID "TMPL6WArjwAh3"
#define BLYNK_TEMPLATE_NAME "Servo1"
#define BLYNK_AUTH_TOKEN "0OtEZTKQ7tJpkS5oggL3asV-TZWht5rL"
#include <ESP32Servo.h> // เรียกใช้งานไลบรารี่สำหรับจัดการเซอโวมอเตอร์
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = "0OtEZTKQ7tJpkS5oggL3asV-TZWht5rL";
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
Servo motor1;
Servo motor2;
void setup() {
Serial.begin(115200);
Serial.println("Hello, ESP32!");
Blynk.begin(auth, ssid, pass);
motor1.attach(23);
motor2.attach(22);
}
void loop() {
Blynk.run();
}
BLYNK_WRITE(V0)
{
motor1.write(param.asInt());
delay(1000);
}
BLYNK_WRITE(V1)
{
motor2.write(param.asInt());
delay(1000);
}