The digital inputs are designed to return 1 if the switch is open or disconnected. It returns 0 only when closed.
The code you posted never does anything if the switch is closed (rc_dig_in01 is 0).
Try something like:
Quote:
Originally Posted by SoD
if (rc_dig_in01 == 1)
{
relay1_fwd = 0;
relay1_rev = 0;
}
else
{
relay1_fwd = 1;
relay1_rev = 0;
}
|