DS1307 Alarm porject

I’m working on a simple little project, Basically I want to sound an alarm for a few seconds at the same time every day (apart from week ends) I’ve put some code together and got the DS1307 working and a 15 second repeat alarm going to serial port at the moment but the morning alarm is not been sent. say if I set it like Alarm.alarmRepeat(17,45,0,EveningAlarm); // 5:45pm every day nothing happens
Could some one have a quick look to see where I may be going wrong

#include <Wire.h>  // Required by RTClib
#include <LiquidCrystal.h>  // Required by LCDKeypad
#include <LCDKeypad.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <TimeAlarms.h>
LCDKeypad lcd;

void setup() {
   Serial.begin(9600);
   lcd.begin(16, 2);
   lcd.clear();
     Alarm.alarmRepeat(13,50,00, MorningAlarm);  // 8:30am every day
  Alarm.alarmRepeat(17,45,0,EveningAlarm);  // 5:45pm every day 
  Alarm.alarmRepeat(dowSaturday,8,30,30,WeeklyAlarm);  // 8:30:30 every Saturday 
Alarm.timerRepeat(15, Repeats);            // timer for every 15 seconds    
  Alarm.timerOnce(10, OnceOnly);             // called once after 10 seconds 
}

void loop() {
  
  tmElements_t tm;
Alarm.delay(1000); // wait one second between clock display
   (RTC.read(tm)); 
     lcd.setCursor(0,0);
     print2digits(tm.Day);
    lcd.print(tm.Day);
   lcd.print('/');
   print2digits(tm.Month);
    lcd.print(tm.Month);
    lcd.print('/');
    lcd.print(tmYearToCalendar(tm.Year));
    lcd.setCursor(0,1);
    print2digits(tm.Hour);
    lcd.print(tm.Hour);
    lcd.print(':');
    print2digits(tm.Minute);
    lcd.print(tm.Minute);
    lcd.print(':');
    print2digits(tm.Second);
    lcd.print(tm.Second);
    
     
}

void print2digits(int number) {
  if (number >= 0 && number < 10) {
    lcd.print('0');
  }
  //Serial.print(number);
}
// functions to be called when an alarm triggers:
void MorningAlarm(){
  Serial.println("Alarm: - turn lights off");    
}

void EveningAlarm(){
  Serial.println("Alarm: - turn lights on");           
}

void WeeklyAlarm(){
  Serial.println("Alarm: - its Monday Morning");      
}

void ExplicitAlarm(){
  Serial.println("Alarm: - this triggers only at the given date and time");       
}

void Repeats(){
  Serial.println("15 second timer");         
}

void OnceOnly(){
  Serial.println("This timer only triggers once");  
}
     Alarm.alarmRepeat(13,50,00, MorningAlarm);  // 8:30am every day

13:50 is not 8:30 AM in my part of the world.

What is up with your indenting? Drinking and programming is not a

good idea.

PaulS:     Alarm.alarmRepeat(13,50,00, MorningAlarm);  // 8:30am every day

13:50 is not 8:30 AM in my part of the world.

The time was just an example what I set it for rather than wait for 8:30 everyday :) May be I was been thick and forgot to remove it :) Bearing in mind I'm new to this arduino stuff code and be tidied up later and this the way I see everyone else do it. thanks for the tip

In your sketch, there are two different clocks.

There is the internal millis timer of the Arduino, which starts at 0 when a sketch begins, and counts the time from there. The Time and TimeAlarms libraries are based on this internal clock and use its values.

You also have RTC which you are reading with RTC.read™ which is giving you a “real time”.

You need to synchronize the internal clock with the rtc, that is, set the real time values into the internal millis clock, and the time alarms will be using “real time” instead of the millis value since the sketch began running.

In the Time Library examples, take a look at “TimeRTC” which synchronizes the internal clock to the RTC and displays the synchronized time. The Time library will automatically synchronize to the RTC every 5 minutes. The TimeAlarms will work along with it, now following the “real time” in the Time Library.

Additionally, you should modify your code to follow that example and display the synchronized time from the Time library.

Thanks cattledog that makes sense and very well explained. I will have a play over the weekend and should be able to get it working from that will let you know how it goes Once again thank you for your help Steve

Thanks I read up on the rtctime and got it all working and printing the data from the ardiuno rather than the rtc. Just one question if it’s powered up continuos will the rtc autmaticly sync with ardiuno or will I have to set it to do so

if it's powered up continuos will the rtc autmaticly sync with ardiuno

Yes. The default is to synchronize every 5 minutes. It is a settable parameter in the Time Library using

setSyncInterval(time_t interval); // set the number of seconds between re-sync