int buzzer=13;
int potPin=A5;
int potVolt;
float buzzFreq;
void setup() {
// put your setup code here, to run once:
pinMode(buzzer, OUTPUT);
pinMode(potPin, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
//Serial.println(buzzFreq);
potVolt=analogRead(potPin);
buzzFreq=potVolt/1023.*10000;
//buzzFreq=map(potVolt,0, 1023,0,10000);
digitalWrite(buzzer,HIGH);
delayMicroseconds(buzzFreq);
digitalWrite(buzzer, LOW);
delayMicroseconds(buzzFreq);
}