View Single Post
  #10   Spotlight this post!  
Unread 05-02-2009, 15:17
Pasha Pasha is offline
Registered User
None #1403
 
Join Date: Jan 2008
Location: Ukraine
Posts: 8
Pasha is an unknown quantity at this point
Re: Limit Switchers Logic Problem

Quote:
Originally Posted by Greg McKaskle View Post
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.