Here is the short sketch we used to allow keyboard to control servo position

 

#include <Servo.h>
// includes the required LIBRARY

Servo myservo;
// Create an object of type Servo, calling it by the name of myservo

void setup()
{
  Serial.begin(9600);  // serial terminal at 9600 baud
  myservo.attach(6);   // assign pin 6 (d6) for servo.  (or pin you used)

}


void loop()
{
    int k = Serial.available();    // check if any character(s) came?
    if (k>0)                       // if character cound above zero ...
    {   int chr = Serial.read()- '0'; // read the incoming character
        if (chr >=0 && chr <=9)       // if it is from 0 up to 9 ...
            myservo.write(chr*20);    // then set servomotor from 0 to 180
    }

}