#include <ESP32Servo.h>
#define PIN_POTENTIOMETER 14
#define PIN_SERVO 4
Servo myServo;
void setup() {
myServo.attach(4);
Serial.begin(9600);
}
void loop() {
int analogValue = analogRead(PIN_POTENTIOMETER);
int angle = map(analogValue,0,4095,0,180);
myServo.write(angle);
Serial.print("Analog value: ");
Serial.print(analogValue);
Serial.print(" => Angle:");
Serial.println(angle);
delay(1000);
}