#include <ESP32Servo.h>
const int potPin = 34;
const int ledPin = 22;
const int buzzerPin = 23;
const int servoPin = 4;
const int maxPotValue = 4095;
Servo myServo;
void setup() {
Serial.begin(115200);
pinMode(potPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
myServo.attach(servoPin);
}
void loop() {
int potValue = analogRead(potPin);
int servoAngle = map(potValue, 0, maxPotValue, 0, 180);
myServo.write(servoAngle);
if (potValue >= maxPotValue) {
digitalWrite(ledPin, HIGH);
digitalWrite(buzzerPin, HIGH);
}else {
digitalWrite(ledPin, LOW);
digitalWrite(buzzerPin, LOW);
}
delay(10);
}