Making a solenoid stay on

Alright so we’re trying to use a solenoid valve and are wondering if there’s a way to make it open the valve when we press button 3 and stay open until we press button 5 to close it. Is there any way to do this?

The left example is for a single solenoid.
The right example is for a double solenoid.
A double solenoid uses “Forward” and “Reverse” because it is controling two solenoid outputs from the PCM, while a single solenoid just needs to use “On” and “Off”.

As far as the hardware, the double solenoid valves in the recent KOPs and most other doubles are designed exactly for this mode of operation. You only need to apply electricity to the solenoid for a fraction of a second (referred to as a strobe in the WPIlib) to force the change of state; air pressure then holds it in that state until you strobe the other side.

If you decide to use single solenoid valves, most of them have a “spring return” or equivalent setup; to keep them in the non-default position, you have to keep the electrons flowing.

Alright thank you both!