String to Int Function from aurdino example

running the exact code .
the arduino is conected through usb to PC.

using the serial monitor i get the display in the quotes


String toInt():"

what ever number i input and press enter nothing is displayed..

what seems to be the problem?

What do you have the baud rate of the Serial monitor set to ?
What line ending do you have the Serial monitor set to ?

Simple servo test code using the String toInt() function.

//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.println("servo-test"); // so I can keep track of what is loaded

void loop() {

  while (Serial.available()) {
    char c =;  //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

Strings (with a capital S) are overkill.

Even a character array might well be overkill here.

I'm pretty sure your problem is on line 22...oh, wait! You didn't bother to post your code, which would have made is a lot easier to solve your problem. Please read the two posts at the top of this Forum by Nick Gammon on how to effectively get the most help possible when using this Forum. It will help us help you.