The buzzer sounds only a few times

How do you make the buzzer only flash twice?

What board?
What buzzer?
What code?

I want the sound to turn off after a few times

void buzzer_high() {
  digitalWrite(buzzer, HIGH);
  delay(300);
  digitalWrite(buzzer, LOW);
  delay(300);
}

No idea without more information.

Take some time and read this post. It will help.
How to get the best out of this forum - Using Arduino / IDE 1.x - Arduino Forum

Did you know that the alarm when the motorbike key is pressed only sounds a few times and immediately stops, yes I want it to be like that

There are different types of Arduino compatible boards, different types of buzzers, and different ways of connecting them. Your question is very difficult to answer without more information about what you have and how it's connected.

Let's try this another way. Does your buzzer work at all now?

I use a buzzer that only goes off when it's high and goes off when it's low

That doesn't help.

What Arduino are you using?

I use this, I am using arduino nano
Buzzer

A picture of a product does not help either.

Please go back through and answer all of my questions with detailed information.

  • Always show us a good schematic of your proposed circuit.
  • Show us good images of your ‘actual’ wiring.
  • Give links to components.

In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.
Use the < CODE / > icon from the ‘posting menu’ to attach the copied sketch.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.