My understanding of pneumatics is that you either want them on (a one and a zero) or off (two zeros). Your code should read:
Code:
if (p1_sw_trig == 1)
{
relay1_fwd = 1;
relay1_rev = 0;
}
else if (p1_sw_top == 1)
{
relay1_fwd = 0;
relay1_rev = 0;
}
else
{
}
All that flipping the relay fwd and backward does is reverse the polarity of the electricity which, in this case, does nothing. You want to simply turn OFF the signal by sending two zeros.