Page 1 of 1

Coding doser for only one day a week?

Posted: Thu Jul 10, 2014 2:22 am
by 89delta
Is it possible to code the dosers to run once a week for 5 seconds with the second doser 5min later? I looked at the time library and saw there is a day of week with sunday being 1 although I don't know where to set it with the RA+ or how to access that to make it available in the time/date menu.

Re: Coding doser for only one day a week?

Posted: Thu Jul 10, 2014 8:18 am
by rimai
Come one man :)
If you even saw the function in the libraries, you know the answer to this!!! :ugeek:

Code: Select all

if (weekday()==1 && hour()==8 && minute()==0&&second()<5)
  ReefAngel.Relay.On(Port1);
else
  ReefAngel.Relay.On(Port1);
Or another alternative:

Code: Select all

ReefAngel.Relay.Set(Port1,weekday()==1 && hour()==8 && minute()==0&&second()<5);
Or a more complicated method:

Code: Select all

ReefAngel.Relay.Set(Port1,now()%SECS_PER_WEEK<5);
The above method would dose at midnight instead of 8am though.

Re: Coding doser for only one day a week?

Posted: Thu Jul 10, 2014 11:57 am
by 89delta
Thanks ramai, I did see the function although i'm not sure if the rtc is set correctly to the current day. I guess it really doesnt matter since it'll just be done once a week. But thanks for the code structure help.