View Single Post
  #5   Spotlight this post!  
Unread 23-03-2010, 09:04
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: Servo control with a joystick

Quote:
Originally Posted by Robototes2412 View Post
Thanks!

Just to verify:

Code:
    public double convert(double input) {
        //newValue = newMax + (newMax - newMin) * (oldValue- oldMax) / (oldMax - oldMin)
        input = 1 + (1 - 0) * (input- 1) / (1 - -1);
        return input;
    }
You can verify it by plugging in your input extremes (-1 to +1). I haven't had my coffee yet, but it doesn't seem like -1 converts to 0. Why not try the one I posted? KISS
__________________
I don't need a signature.
Reply With Quote