how to control servo

I am controlling servo by potentiometer Here the sample code in arduino library

value=readAnalog(potentiometer); degree=map(value,0,1023,0,180); myservo.write(degree) if degree=30; the servo will turn to 30 degree I get confusion what is exact thing make servo to turn into 30 degree Can anyone explain me

what is exact thing make servo to turn into 30 degree

myservo.write(degree);

where the value of degree is 30 as a result of reading the pot and using map() to convert the 0 - 1023 value returned into the range 0 - 180 for the servo.

value=readAnalog(potentiometer);

readAnalog? How about you post some code that ACTUALLY compiles? How about you explain what value is in potentiometer? How about you explain how the potentiometer is wired? How about you Serial.print() the value read from the pin, so you have a clue what is happening.

what is exact thing make servo to turn into 30 degree

I don't think you can make a servo turn INTO 30 degree. You can make it turn TO 30 degrees.

Very basic servo test code you can use to get your servo setup and working using the serial monitor.

//zoomkat 7-30-10 serial servo test
//type servo position 0 to 180 in serial monitor
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.attach(9);
  Serial.println("servo-test"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the String readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured String 
    int n = readString.toInt();  //convert readString into a number
    Serial.println(n); //so you can see the integer
    myservo.write(n);
    readString="";
  } 
}

PaulS: value=readAnalog(potentiometer);

readAnalog? How about you post some code that ACTUALLY compiles?

Ha, I must be getting old - had to look at this for a minute before I saw what was actually wrong with it. :(