#define BUZZER_PIN 5
#define POT_PIN 34
void setup() {
Serial.begin(115200);
}
void loop() {
int potValue = analogRead(POT_PIN); // 0-4095 on ESP32
int frequency = map(potValue, 0, 4095, 200, 2000); // Map to 200–2000 Hz
Serial.print("Pot: ");
Serial.print(potValue);
Serial.print(" Freq: ");
Serial.println(frequency);
tone(BUZZER_PIN, frequency); // Play tone
delay(50);
}