Arduino MEGA + DS1307 Clock

Dear, good morning, I need to turn on a light on certain days of the week, which library could use. I am using TimeAlarm and apparently do not allow it.

What I would need is:

Turn on Monday, Wednesday and Thursday: 12:00 and turn off at 14:00 for example.

From already thank you very much,
regards
Juan

Which library are you using because TimeAlarms has all the functions you need.

https://www.pjrc.com/teensy/td_libs_TimeAlarms.html

You forgot to post your complete code! Don't forget to use code tags (that's the </> button in the editor)!

Thanks for your reply. If I'm using that library. But how can I set an alarm:
Tuesday and Thursday
Monday Wednesday Friday

These cases are what I need to do?

And if I wanted to put an alarm on 6/28 ?? today?? How could I do with that library?

Thank you!!

Alarm.alarmRepeat(dayofweek, hours, minutes, seconds, function);
Create an alarm that will call a function every week on a specific day at a particular time.
"dayofweek" can be dowSunday, dowMonday, dowTuesday, dowWednesday, dowThursday, dowFriday, or
dowSaturday.

Alarm.alarmOnce(dayofweek, hours, minutes, seconds, function);
Create an alarm that will call a function once, at specific day and time.

You can use the Alarm.alarmOnce() to set each successive alarm from within the function called by the previous alarm.

Thanks for your reply. But how would I place an alarm for 6/6 today?

I was clear about the form for the days each week.

Thank you!!

Perdón quise decir para el 26/6 hoy

gracias!!

Or, simply use the alarm like a watchdog timer and generate a function call every hour or so. Then query the 1307 to find out when it is and check your own activity list to see if there is something you should be doing. All of this could be done of course without the library.

Hoy es el día 22 no?

Yes, but the alarms for 22/6

Thanks, have any examples?
to do this?

I tend to do things a bit different. Have a look at

https://playground.arduino.cc/Code/TimedAction

and see if it gives you any ideas.

One question, this code, runs the next dowFriday?
or would be implemented today, in Uruguay today is Friday.

Alarm.alarmRepeat(dowFriday, hours, minutes, seconds, function);
//Create an alarm that will call a function every week on a specific day at a particular time.
//"dayofweek" can be dowSunday, dowMonday, dowTuesday, dowWednesday, dowThursday, dowFriday, or //dowSaturday.

Good question. At that point, query the 1307. Is not every Friday the same?

That's the problem I think, since I do not find a valid relationship between the day value that the ds1307 gives me and the days of the week.
In some cases dayofweek tells me 1 for Monday and in other cases it says 1 for Sunday.

For determining the correct day of the week, maybe you will find something from here to be useful:
https://forum.arduino.cc/index.php?topic=198103.0

For sure the 1307 will give you day, date, month and year.

FYI all modern time keepers store the current time in the Unix time format which is a 31-bit value equal to the number of seconds since midnight, Jan 1, 1970. There are numerous methods of translation.