Pages: [1]   Go Down
Author Topic: TimeAlarms question  (Read 394 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Offline Offline
Faraday Member
**
Karma: 68
Posts: 2787
The last thing you did is where you should start looking.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

See:    http://arduino.cc/forum/index.php/topic,45342.0.html
Logged

The way you have it in your schematic isn't the same as how you have it wired up! That goes for me too.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 !
Logged

Pages: [1]   Go Up
Jump to: