Pages: [1]   Go Down
Author Topic: User defined timeAlarm times?  (Read 235 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I'm making an Arduino controlled sprinkler system using an ethernet shield so that it can be controlled through the web.  I'm working on the schedule and wonder if there is a way to use the timeAlarms library in a way so that the user can change the dates/times of the alarms?  What I have in mind is to create a number of functions such as:

Code:
  Alarm.alarmRepeat(h1,m1,0, ZoneOne);
  Alarm.alarmRepeat(h2,m2,0, ZoneTwo);
...
...

And the user will have input boxes for each zone to change the time, date, etc.  However, from what I understand the alarmRepeat function is supposed to be called in the setup(), not from the loop(), so would this even be possible? 

Thanks for any help!
-Ryan
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
However, from what I understand the alarmRepeat function is supposed to be called in the setup(), not from the loop(), so would this even be possible?
The alarmRepeat() method is typically called from setup(). This is so that it is not called on every pass through loop(). However, if the time to have the alarm go off changes, because of user input, there is no reason not to call alarmRepeat() from loop(), once in a while.
Logged

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

The alarmRepeat() method is typically called from setup(). This is so that it is not called on every pass through loop(). However, if the time to have the alarm go off changes, because of user input, there is no reason not to call alarmRepeat() from loop(), once in a while.

Once in a while...so 8 times (one for each sprinkler zone) probably wouldn't be the best idea?

Would it work to create global variables such as h1, h2, h3 etc. for hours and m1, m2, m3 etc. for minutes, call the alarmRepeat() function in setup(), and have the user change the variables in loop()?  Or would I need to call the alarmRepeat() functions in loop() for this to work? 
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Once in a while...so 8 times (one for each sprinkler zone) probably wouldn't be the best idea?
That would be fine. It's 16,000,000 times a second that would not.
Logged

Pages: [1]   Go Up
Jump to: