This code is designed to use cycles in controlling a simple 3 wire valve.
Repo: wisplib_valve_3wire
Nature runs in cycles; wisps are built so.
Cycles are set up on a per valve basis.
Find the switch case in the Valve_3wire library, required for this wisp.
Each case you define is used to create a custom cycle, in the event you have multiple valves.
The default is case 1, which turns the valve on for five minutes every hour around the clock.
Every five seconds this code steps into a function called ValveRun, which tests if its time to take action. Each valve that's defined will need a corresponding run function in loop().
Define your valve:
Valve compostValve(1,7,8,1);
Valve (int incId, byte incValveOnPin, byte incValveOffPin, int incMode)
incID: Set a unique id for this valve.
incValveOnPin: Pin on arduino that turns valve on.
incValveOffPin: Pin on arduino that turns valve off.
incMode: Sets cycle characteristics.
And then make sure you place the following in loop():
ValveRun(compostValve, currentMillis);