// Define the GPIO pin connected to the potentiometer.
#define potPin 34 // Analog input pin (use GPIO34 as an example)
void setup() {
// Start the serial communication at 115200 baud rate for debugging.
Serial.begin(115200);
// Optional: Print a startup message.
Serial.println("ESP32 Analog Reading Example");
}
//map()
void loop() {
// Read the analog value from the potentiometer (0-4095 range).
int analogValue = analogRead(potPin);
int timeOut=map(analogValue,0,4095,500,1000);
// Print the analog value to the Serial Monitor.
Serial.print("Analog Value: ");
Serial.println(timeOut);
// Add a small delay to make the output readable.
delay(1500);
}