|
Re: Limit Switchers Logic Problem
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
|