// Define the analog pin
int potPin = 2; // GPIO 34 (you can change it to any other available ADC pin)
// Variable to store potentiometer value
int potValue = 0;
void setup() {
// Start the Serial communication
Serial.begin(115200);
// Configure the analog pin
pinMode(potPin, INPUT);
}
void loop() {
// Read the value from the potentiometer (range from 0 to 4095 for ESP32)
potValue = analogRead(potPin);
// Display the potentiometer value on the Serial Monitor
Serial.print("Potentiometer Value: ");
Serial.println(potValue);
// Wait for a short period
delay(500);
}