Coding doser for only one day a week?

Do you have a question on how to do something.
Ask in here.

Posts: 156
Joined: Mon Oct 15, 2012 7:21 pm
Location: Albany, GA
PostPosted: Thu Jul 10, 2014 2:22 am
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.

Posts: 12507
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Thu Jul 10, 2014 8:18 am
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.

Posts: 156
Joined: Mon Oct 15, 2012 7:21 pm
Location: Albany, GA
PostPosted: Thu Jul 10, 2014 11:57 am
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.

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 1 guest

cron