#include <LiquidCrystal_I2C.h>
#include <ESP32Servo.h>
// define the pin numbers for the potentiometer, servo motor, and LCD display
const int potentiometerPin = 35;
const int servoPin = 23;
// create an object for the servo motor and the LCD display
Servo servo;
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
// set up the servo motor and LCD display
servo.attach(servoPin,500, 2400);
// lcd.begin();
lcd.init();
lcd.backlight();
}
void loop() {
// read the value of the potentiometer
int potValue = analogRead(potentiometerPin);
// map the potentiometer value to a angle between 0 and 180
int angle = map(potValue, 0, 1023, 0, 180);
// set the servo motor to the specified angle
servo.write(angle);
// display the current angle on the LCD display
lcd.setCursor(0, 0);
lcd.print("Angle: ");
lcd.print(angle);
lcd.print(" degrees");
// delay for a short period of time
delay(1000);
}