// Passive Buzzer Code
// Another stuff tells us about how you can control buzzer using potentiometer
// Tone Generator
int buzzpin=8;
int potpin = A3;
int potval;
int toneval;
// int buzzTime=1;
// int buzzTime2=60;
void setup() {
// put your setup code here, to run once:
pinMode(buzzpin , OUTPUT);
pinMode(potpin , INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
potval=analogRead(potpin);
toneval=(9940./1023.)*potval+60;
digitalWrite(buzzpin , HIGH);
delayMicroseconds(toneval);
digitalWrite(buzzPin , LOW);
delayMicroseconds(toneval);
}