Hi. I'm trying to make a CO2 detector. basically when there's more than 200 I want it to light up led and activate a buzzer. while the led works, the buzzer only lets out like a ticking sound and I have no idea why. I'm new to this and I don't know coding well. also I checked the buzzer and it works in my other project. Here is my code
int analog = A0;
int value = 0;
int buzzer = 6;
int led = 13;
void setup() {
pinMode(analog, INPUT);
pinMode(led, OUTPUT);
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (value > 200) {
digitalWrite(buzzer, HIGH);
digitalWrite(led, HIGH);
}
else digitalWrite(led, LOW);
digitalWrite(buzzer, LOW);
value = analogRead(analog);
Serial.println(value);
delay(250);
}