A valve includes a chamber and a piston positioned at least partially in the chamber. A first POLYMAGNET is coupled to a first side of the piston, and a second POLYMAGNET is positioned in the chamber and faces the first POLYMAGNET. An actuator is coupled to the second POLYMAGNET and rotates the second POLYMAGNET from a first rotational position to a second rotational position, which causes the first POLYMAGNET and the piston to move with respect to the second POLYMAGNET.