The below might be of use. It works with IDE 0018. IDE 0020 includes a string library.
// zoomkat 7-30-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// http://arduino.cc/en/uploads/Tutorial/String.zip for WString.h
#include <WString.h> //provides easy string handling
String readString = String(100);
#include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup() {
Serial.begin(9600);
myservo.attach(9);
}
void loop() {
while (Serial.available()) {
delay(10);
if (Serial.available() >0) {
char c = Serial.read(); //gets one byte from serial buffer
readString.append(c); } //makes the string readString
}
if (readString.length() >0) {
Serial.println(readString);
int n;
n = atoi(readString); //convert string to number
myservo.writeMicroseconds(n);
//myservo.write(n);
readString="";
}
}