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.
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.
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.
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.
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.
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.