Go Down

Topic: User defined timeAlarm times? (Read 284 times) previous topic - next topic

ryanmcclure4

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: [Select]

  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

PaulS

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.

ryanmcclure4


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? 

PaulS

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.

Go Up