How to Create logic

hi PeterH,

currently we are working on hydraulic system which we want to control by arduino.

here P1 is piston and L2 is limit switch , which is at the bottom limit of the piston strock.

when p1 coming at down side it will Activate L2(push L2)

Means

CASE 1
When P1 on (Piston going down side, Piston supply connected to P1)
S1 and S3 on for 10 sec (Same time S1 and S3 pin should be high)
but if

L2 on
Close S1 and S3
and Open S2 and S4 for 10 second
(means when piston push L2 limit switch after reaching/triggering L2, S1 and S3 should be Low and S2 and S4 High for 10 sec)