#include <ESP32Servo.h>
Servo myservo; //create servo object to control servo
int potpin = 13; //analog pin connect to potentiometer
int val; // read value from analog pin
void setup()
{
 myservo.attach (17); //servo pin
}
void loop()
{
 val = analogRead (potpin); //read value of potentiometer
 val = map(val, 0, 1023, 0, 180);
 myservo.write(val);
delay (15);
}