int sensorPin = A0; // select the input pin for the potentiometer
int buzzer = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
void setup()
{
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
if (sensorValue < 40) {
tone(buzzer, 1000);
}
else {
noTone(buzzer);
}
}