I am trying to change up some arduino code to accept potentiometer input for variable turn rate. This is what I have right now but I can only tell it turn or dont turn. I need help adding the potentiometer part to it.

//steer one way SteerValue of 512 is straight ahead if (k2 == 1) { if (gangleratedeg2 < 5) { //will turn clockwise at 5 degrees per sec and if not, more power fed into steering until it does SteerValue = SteerValue + 1; } if (gangleratedeg2 > 5) { SteerValue = SteerValue - 1; } } //change the 5 and -5 values if you want faster turn rates. Could use a potentiometer to control these values so would have proportional control of steering

//steer the other way if (k3 == 1) { if (gangleratedeg2 < -5) { //will turn anticlockwise at 5 degrees per sec and if not, more power fed into steering until it does SteerValue = SteerValue + 1; } if (gangleratedeg2 > -5) { SteerValue = SteerValue - 1; } }

Difficult to say from such a brief snippet of code (please use the # icon in the editor's toolbar when posting code), but I think you're going to need to look at "analogRead" and "map".http://arduino.cc/en/Reference/AnalogReadhttp://arduino.cc/en/Reference/Map

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.