#include <ESP32Servo.h>
Servo myServo;
int pos = 0;
const byte servoPin = 15;
const byte potPin = 27;
void setup() {
Serial.begin(115200);
myServo.attach(servoPin);
myServo.write(0);
delay(1000);
}
void loop() {
delay(10);
int val = analogRead(potPin);
pos = map(val, 0, 4095, 0, 180);
myServo.write(pos);
}