Code :-
#define BLYNK_TEMPLATE_ID "TMPLP6t-OSz9"
#define BLYNK_DEVICE_NAME "servo control esp32"
#define BLYNK_AUTH_TOKEN "ci76Y8ePfXyn_xalXnzTEgZoEJjTsisM"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <ESP32Servo.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "wifi name";
char pass[] = "0987654321";
Servo indexservo;
Servo mid;
Servo ring;
Servo lit;
Servo thumb;
BLYNK_WRITE(V0) {
int index1servoval=param.asInt();
indexservo.write(param.asInt());
}
BLYNK_WRITE(V1) {
int midservoval=param.asInt();
mid.write(midservoval);
}
BLYNK_WRITE(V2) {
int ringservoval=param.asInt();
ring.write(ringservoval);
}
BLYNK_WRITE(V3) {
int litservoval=param.asInt();
lit.write(litservoval);
}
BLYNK_WRITE(V4) {
int thumbservoval=param.asInt();
thumb.write(thumbservoval);
}
void setup() {
// put your setup code here, to run once:
WiFi.begin(ssid, pass);
Blynk.begin(auth,ssid,pass);
indexservo.attach(26);
mid.attach(25);
ring.attach(33);
lit.attach(32);
thumb.attach(27);
}
void loop() {
// put your main code here, to run repeatedly:
Blynk.run();
}
0 Comments