View Single Post
  #3   Spotlight this post!  
Unread 22-03-2010, 02:00
FRC4ME FRC4ME is offline
Registered User
FRC #0339
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Fredericksburg, VA
Posts: 324
FRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant future
Re: Servo control with a joystick

FYI, the general formula for scaling one range of values to another is:

Code:
newValue = newMax + (newMax - newMin) * (oldValue- oldMax) / (oldMax - oldMin)
In this case, oldMin and oldMax are -1 and 1, respectively (the joystick range), while newMin and newMax are 0 and 1, respectively (the servo range).
__________________
Go directly to queue. Do not pass pit.
Reply With Quote