Help with serial communication and servo?

ok so basically i need to be able to write up to a three digit number into a variable on the arduino so that that variable can be set as the position of my servos arm.

Below is what I have so far.

#include <Servo.h>


Servo myservo;
const int ledPin = 13;
int pos = 0;
int incomingByte; 
int m = 0;
int ledState = LOW; 
int value = 0;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  myservo.attach(9);
}

void loop() {
while (Serial.available() > 0)
{
  value *= 10;
  value += (Serial.read() - '0');
  delay(100);
}

myservo.write(value);
}

I didn't see a question in there, but "value" is going to get very big, then very negative, then positive again. Not sure what the "delay" is for, apart from potentially cause the input buffer to get very full.

To elaborate on AWOL's comments, you never reset value, so it will just continue to get larger and larger, until it overflows.

You appear not to be delimiting the value in any way, so if you send 90, 70, 40 to the Arduino, it will see "907040". Where does one value end and the next begin? In other words, when do you know to reset value?

Some servo control code that might be of use.

// zoomkat 10-4-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// for IDE 0019 and later
// 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(7);  //the pin for the servo control 
  Serial.println("servo-test-21"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(10);  
    if (Serial.available() >0) {
      char c = Serial.read();  //gets one byte from serial buffer
      readString += c; //makes the string readString
    } 
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string 
    int n;
    char carray[6]; //converting string to number
    readString.toCharArray(carray, sizeof(carray));
    n = atoi(carray); 
    myservo.writeMicroseconds(n); // for microseconds
    //myservo.write(n); //for degees 0-180
    readString="";
  } 
}