const int buzzerPin = 9;
const int potentiometerPin = A0;
int volume = 0;
void setup() {
Serial.begin(115200);
}
void loop() {
volume = analogRead(potentiometerPin);
int frequency = map(volume, 0, 1023, 50, 5000);
tone(buzzerPin, frequency);
Serial.print("Potentiometer Value: ");
Serial.println(volume);
delay(100);
}