Coding doser for only one day a week?

Do you have a question on how to do something.
Ask in here.
Post Reply
89delta
Posts: 163
Joined: Mon Oct 15, 2012 7:21 pm
Location: Leesburg, GA

Coding doser for only one day a week?

Post 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.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Coding doser for only one day a week?

Post 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.
Roberto.
89delta
Posts: 163
Joined: Mon Oct 15, 2012 7:21 pm
Location: Leesburg, GA

Re: Coding doser for only one day a week?

Post 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.
Post Reply