Go Down

Topic: TimeAlarms question (Read 869 times) previous topic - next topic


Hi all,

I managed to run a dynamically alarm with only hour,minute and second (with this values from serial), now I need to set up it using weekdays, but I until right now I can't do that, cuz it only works if I put on code the "dowSomeWeekday".

If anybody can help me, I need to know how to convert an int into dow (timeDayOfWeek_t).

Code: [Select]
Alarm.alarmRepeat(weekday,hora,minuto,segundo, ligaDispositivos);

Where is weekday I need to put a variable that represents some of the timeDayOfWeek_t, for exemplo dowSunday.


See:    http://arduino.cc/forum/index.php/topic,45342.0.html
No technical PMs.
The last thing you did is where you should start looking.


Thanks for replying, but that topic don't solves my problem.

I need to set up the alarm with weekdays, but I want to set the weeday in the Alarm.alarmRepeat function, not verify with a if statement.

I want to get a number from 1 to 7 from serial, assign this number to a variable and than use the variable in the Alarm fuction, but can't use an int to represents the weekdays (dowSunday, dowMonday and so on).

Is there any way of doing that without using hardcode or if statement ?


I found the answer to my question !

I just needed to declare the variable as timeDayOfWeek_t as below:

timeDayOfWeek_t somevariable[7] = {dowSunday, dowMonday, etc..};

Then just use it !

Go Up