int buzpin=6;
int potpin=A1;
int potval;
int toneval;


void setup() {
// put your setup code here, to run once:

Serial.begin(9600);
pinMode(potpin, INPUT);
pinMode(buzpin, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:

potval=analogRead(potpin);
Serial.println(potval);

toneval=(9940./1023.)*potval +60;

digitalWrite(buzpin, HIGH);
delayMicroseconds(toneval);
digitalWrite(buzpin,LOW);
delayMicroseconds(toneval);



}
//https://wokwi.com/projects/408186264425029633