Paul_KD7HB:
Back up one step. How do your relays operate? Do they close and send 12 volts to the hydraulic valve when the control signal is low or 0? Or do the relays close and send 12 volts when the control signal is high or 1?That information is the ultimate control for how your program MUST behave.
Paul
Or is it 12V to open and 12V to close the valve?