const int buzzerPin = 9;
const int potentPin = A2;
void setup() {
// put your setup code here, to run once:
pinMode(buzzerPin, OUTPUT);
}
//noise is the frequency
void loop() {
int potentValue = analogRead(potentPin);
int noise = map(potentValue, 0, 1023, 0, 255);
tone(buzzerPin, noise);
}