Quote:
Originally Posted by SoD
oops I though it should give 1 xD
So if i change it to ==0 it should work?
|
Usually we give it something to do when it's equal to 1 and something different to do when it's equal to 0.
Relay1 will only change when we explicitly change it. The last thing we did will always be in effect.
For example, in your original code the relay was set to:
Code:
relay1_fwd = 0; relay1_rev = 0;
in User_Initialization(), then your code changed to to the same value.
Nothing ever changed it to 1.
If you modify your code to use "==0" instead and change it to set the Relay to 1, then Relay1 will begin as 0 and change to 1 when you flip your switch, but nothing will ever change it back to 0 if the switch is flipped off again.