Timed alarms again

I have a simple daily alarm set to sound a buzzer for 3 seconds at the set time, But sometimes it does not switch the buzzer off, It can do this at different times and freezes out until I press the reset then next time it works ok.
Am I doing something wrong ?
Code:

#include <Wire.h>  // Required by RTClib
#include <LiquidCrystal_I2C.h>

#include <Time.h>
#include <DS1307RTC.h>
#include <TimeAlarms.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

void setup() {
// Serial.begin(9600);
pinMode(13, OUTPUT);
lcd.begin (16,2); // for 16 x 2 LCD module
lcd.setBacklightPin(3,POSITIVE);
lcd.setBacklight(HIGH);
lcd.clear();
lcd.setCursor(0,0);
setSyncProvider(RTC.get);   // the function to get the time from the RTC
if(timeStatus()!= timeSet) 
lcd.print("Unable to sync with the RTC");
else
lcd.print("RTC has set the system time");
delay(1500);
lcd.clear();
Alarm.alarmRepeat(9,58,00,morningstart);  // 09:58am every day
Alarm.alarmRepeat(10,28,00,morningfinish);  // 10:30Am every day 
Alarm.alarmRepeat(12,58,00,dinnerstart);  // 12:58PM every day
Alarm.alarmRepeat(13,28,00,dinnerfinish);  // 1:30Pm every day
Alarm.alarmRepeat(17,25,00,hometime);  // 8:30am every day
}

void loop() { 
digitalClockDisplay();
Alarm.delay(1000); // wait one second between clock display
}

void digitalClockDisplay(){               
lcd.setCursor(3,0);
printDigits(day());
lcd.print(day());
lcd.print("/");
printDigits(month());
lcd.print(month());
lcd.print("/");
lcd.print(year()); 
lcd.setCursor(4,1);
printDigits(hour());
lcd.print(hour());
lcd.print(":");
printDigits(minute());
lcd.print(minute());
lcd.print(":");
printDigits(second());
lcd.print(second());
}

void printDigits(int digits){
if(digits < 10)
lcd.print('0');
}
void morningstart(){
digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(3000);              // wait for a second
digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
}
void morningfinish(){
digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(3000);              // wait for a second
 digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
}
void dinnerstart(){
digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(3000);              // wait for a second
digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
}
void dinnerfinish(){
digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(3000);              // wait for a second
digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
}
void hometime(){
digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(3000);              // wait for a second
digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
 }

Would this work(example)
void hometime(){
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
Alarm.delay(3000);
// wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW

Alarm.alarmRepeat(13,28,00,dinnerfinish);  // 1:30Pm every day
Alarm.alarmRepeat(17,25,00,hometime);  // 8:30am every day

Not in my universe. If you are going to have useless comments, you MUST make them correct useless comments, or risk looking like an idiot.

Am I doing something wrong ?

Yes. You are using the Alarm class but not ALWAYS using Alarm.delay() where you want an unnecessary delay().

You keep catching me out may be I remove stupid comments..... come on I'm new and still learning we all can't be clever :slight_smile:

So your saying using alarm.delay instead of delay(); to turn buzzer on for 3 seconds

So your saying using alarm.delay instead of delay(); to turn buzzer on for 3 seconds

Well, it's Alarm.delay() and it's used to waste time before the buzzer is turned off by some other code, but, yeah, that's the general idea.