#include <ESP32Servo.h>
Servo servo1; // create servo object to control the first servo
Servo servo2; // create servo object to control the second servo
int potpin1 = 32; // analog pin connected to the first potentiometer
int potpin2 = 27; // analog pin connected to the second potentiometer
int val1; // read value from the first analog pin
int val2; // read value from the second analog pin
void setup()
{
servo1.attach(19); // servo1 pin
servo2.attach(5); // servo2 pin
}
void loop()
{
val1 = analogRead(potpin1); // read value of the first potentiometer
val1 = map(val1, 0, 1023, 0, 180);
servo1.write(val1);
val2 = analogRead(potpin2); // read value of the second potentiometer
val2 = map(val2, 0, 1023, 0, 180);
servo2.write(val2);
delay(15);
}