#include <ESP32Servo.h>
/*first servo*/
const int servoPin_1 = 18;
const int potPin_1 = 34;/*potentiometer pin*/
/*second servo*/
const int servoPin_2 = 5;
const int potPin_2 = 25;/*potentiometer pin*/
Servo servo_1;
Servo servo_2;
void setup() {
servo_1.attach(servoPin_1, 500, 2400);
servo_2.attach(servoPin_2, 500, 2400);
}
void loop() {
int potValue_1 = analogRead(potPin_1); // Read the analog value of the potentiometer
int angle_1 = map(potValue_1, 0, 4095, 0, 180); // Map the potentiometer value to a range of angles (0-180)
int potValue_2 = analogRead(potPin_2); // Read the analog value of the potentiometer
int angle_2 = map(potValue_2, 0, 4095, 0, 180); // Map the potentiometer value to a range of angles (0-180)
/*first servo control*/
servo_1.write(angle_1); // Set the servo angle based on the potentiometer value
delay(15);
/*second servo control*/
servo_2.write(angle_2); // Set the servo angle based on the potentiometer value
delay(15);
}