Quote:
Originally Posted by Greg McKaskle
I didn't say to set the value to zero when limit was pressed. One limit switch forces positive motor input to zero but leaves negative alone, the other forces negative and leaves positive alone.
To handle the button toggles, I'd add a state variable. The buttons update the state variable, then the state variable selects positive, zero, or negative speed, then the limit switches pin as described above. The state variable obviously needs to be in either a shift register, a local, or something that maintains state data.
Greg McKaskle
|
But once the limit switch is pushed and it starts to feed positive values. It'll forever continue to force positive values. Even I press another button to go left, it won't because it'll be continuosly fed positive values.