ben-smith Posted May 24, 2011 Posted May 24, 2011 Maybe I just haven't had enough coffee yet, trying to figure out a watering schedule for my in-laws property. He'd like the zones watered 20 minutes each, every other day. I've got the zone timings OK, just trying to figure out how to have the program evaluate running 'every other' day. Thanks,
andyf0 Posted May 24, 2011 Posted May 24, 2011 If you're running the latest beta firmware that supports variables it's quite easy. if Time is 5am And $Irrigate is 1 Then ....................... Insert your zone commands and timings $Irrigate *= -1 $Irrigate Init to $Irrigate Else $Irrigate *= -1 $Irrigate Init to $Irrigate When $Irrigate is 1 you'll run the Irrigation stuff. Multiply $Irrigate by -1 will set it to -1. When $Irrigate is -1 it will multiply it by -1 which gives 1.
apostolakisl Posted May 24, 2011 Posted May 24, 2011 You need to make a counter program. I suggest just haveing a counter that counts days from now to forever ($integervariablecounter). (at 12 am $integervariablecounter += 1) Then in your program, use the %= command to calculate a remainder. $integervariableremainder=$integervariablecounter $integervariableremainder %=2 this will allow an every other day. for example. if the variable is currently 3 and you divide by 2, the remainder will be one. If it is 4, the remainder will be 0. Set your sprinkler to go off on $integervariableremainder either 1, or 0. Either way, it will be every other day. If you change your mind and want every 3rd day, just change to %=3 and so forth. I would write the full out code, but am not at my isy computer.
apostolakisl Posted May 24, 2011 Posted May 24, 2011 Below is my program for creating an every other, every third, every fourth, and every fifth variable. The value of each of those variables will start at 0, count up to it x-1 where x is every x days. ie, for every fourth, it will go 0,1,2,3,0,1,2,3 etc. If Time is 12:00:00AM Then $iDay.Counter += 1 $iEvery.Other.Day.Counter = $iDay.Counter $iEvery.Thrid.Day.Counter = $iDay.Counter $iEvery.Fourth.Day.Counter = $iDay.Counter $iEvery.Fifth.Day.Counter = $iDay.Counter $iEvery.Other.Day.Counter %= 2 $iEvery.Thrid.Day.Counter %= 3 $iEvery.Fourth.Day.Counter %= 4 $iEvery.Fifth.Day.Counter %= 5 $iDay.Counter Init To $iDay.Counter $iEvery.Other.Day.Counter Init To $iEvery.Other.Day.Counter $iEvery.Thrid.Day.Counter Init To $iEvery.Thrid.Day.Counter $iEvery.Fourth.Day.Counter Init To $iEvery.Fourth.Day.Counter $iEvery.Fifth.Day.Counter Init To $iEvery.Fifth.Day.Counter Else - No Actions - (To add one, press 'Action') Now for your sprinkler program If Time is 6am And ievery.other.day.counter = 0 (or you could use 1 for the other half of every other day) Then Sprinkle The beauty of this is how simple it is to change it to a different schedule, so in the spring and fall you might want every 3 or 4. In the winter you might make an every 15'th or 20th depending on your climate. And you can pull these same variables for any other program you want to happen like this. Edit: I added init to's for reboot protection.
ben-smith Posted June 15, 2011 Author Posted June 15, 2011 Thanks, these posts were helpful to get my 'every other' day schedule running.
Recommended Posts