i would like OFF port 5 from
-0858 to 0902
-1158 to 1202
-1458 to 1502
-1758 to 1802.
the rest of time keep ON.
Thanks in advance
Code: Select all
int t=now()%10800; // We are interested in 3 hr intervals
if (hour()>=8 && hour()<=18) // The off period only happens between 8 and 18
ReefAngel.Relay.Set(Port5, !(t<120 || t>10680) ); // Turn off for 2 minutes before and after our intervals
else
ReefAngel.Relay.On( Port5 ); // Keep port on for hours that are not within the off period
Roberto please pardon me, but i dont know how to code my requirements using the example code :primai wrote:Try this:Code: Select all
int t=now()%10800; // We are interested in 3 hr intervals if (hour()>=8 && hour()<=18) // The off period only happens between 8 and 18 ReefAngel.Relay.Set(Port5, !(t<120 || t>10680) ); // Turn off for 2 minutes before and after our intervals else ReefAngel.Relay.On( Port5 ); // Keep port on for hours that are not within the off period
Thanks i understand the part on replacing this code with the existing code. but iam still not sure how to make it always on except the following timing;lnevo wrote:Put that in your loop instead of any other line for that port. You can put it in between the comments that say place custom code here