Problem with buzzer (beeping)

I'm using buzzer and it should beep for 25 seconds with break time between beeps but at the begging it beeps much faster and after 2-3 seconds it starts beeping properly. Do you have any idea what can cause that?

 else if (millis() - time < 25000 &&  state== armed)
   if (millis() - time_last >= break_time) {
    time_last += break_time;
    tone(buzzer, 550,40);

Please post a complete sketch so that the context can be seen

Are time_last and time type unsigned long ?

In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.

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