View Single Post
  #13   Spotlight this post!  
Unread 14-02-2010, 22:26
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Joystick Button One-Shot (a.k.a. Rising Edge) Detection

Quote:
Originally Posted by grosh View Post
Can I ask one more question? Can you explain the logic of the In Range and Coerce for this instance. I have read the context help but don't understand how it works in this instance.
In Range and Coerce takes a lower limit, an upper limit, and an input value. It then does two things.

1: It provides an "In Range" boolean output that is True when the value is between the limits, and False when the value is outside the limits. This feature is not used in the code I showed.

2: It provides a "Coerce"d output value that matches the input value when it is inside the limits, but does not exceed the limits in either direction when the input is outside the range. This is how the motor is kept from driving in a particular direction, by making sure the value never goes above 0.
Reply With Quote