Servo Control

Hello, I am using an arduino uno with a small hobby servo and a 10k pot in order to control the throttle on a gas engine. The servo only has a small amount to move in order to go from idle to full throttle. Thus, I would like to use the full range of the pot to make the throttle less sensitive. I am using the following code which seems to only utilize the first small part of the full range of the pot. Also, just ignore the parts with the buzzer; is it a safety feature.

#include <Servo.h>
#define buzzer 11

Servo myservo;
int pot = 0;
int val1;
int val2;
int lowval = 90;
int highval = 130;

void setup() {
  myservo.attach(6);
  myservo.write(highval);
  tone(buzzer,1000);
  delay(400);
  while(analogRead(pot)<1018){
    tone(buzzer,1000);
  }
  noTone(buzzer);
}

void loop() {
  val1 = analogRead(pot);   
  val2 = map(val1,0, 1023, lowval, highval);    
  myservo.write(val2);               
  delay(10);                           
}

Add some code to print the value of the variable val2 so you can see what is happening.

The range of your servo is 130 - 90 = 40 which is approx 1023 / 25. Another way to calculate val2 would be

val2 = val1 / 25 + 90;

...R

If you want better granularity, use servo.writeMicroseconds() rather than servo.write()
The 0-180 used by servo.write gets mapped into the 1000-2000 range that servo.writeMicroseconds uses.

Also, put a longer arm on the engine throttle and/or a shorter arm on the servo to better address the situation mechanically.