Serial communication

Hi guys!
I'm new to arduino, I have the latest serial one. I want to blink the led with a delay, that I send to the arduino from my pc. If I send something from the arduino IDE, it send it as an ASCII character. So if I send 9, the LED will blink with delay(89); as in the ascii table or, if I send z it will blink with delay(122); and not with delay(9); I want to send for example 560, and the arduino should blink the led with delay(560);. How can I send the board a DEC number, and not only the ascii character code. Can I do a simple program with processing with a simple gui?

A trick I learned here on the forums, so I will pass it on,

while(Serial.available())
        {  
        c = Serial.read();
        if(c < '0' || c > '9') return;
        iValue = iValue * 10 + (c-'0');
        }

So if you send string "560" iValue will equal the number 560.

Note you need to modify it for what you are doing, this is part of a function.

Something like this,

while(Serial.available())
      {  
        c = Serial.read();
        iValue = iValue * 10 + (c-'0');
       }

THANK YOU! =) I'm trying this out now. I'll post my experiences.

With the help of Jassper, I created this piece of code, that can read a full number with more than one digits. Well this is awesom for me! :sunglasses:

Can someone write a simple processing program for this purpose? sending numbers on on serial interface?

int ledPin = 13;                // LED connected to digital pin 13
int c = 0;
int i = 0;
int iValue = 0;
void setup()                    // run once, when the sketch starts
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
  Serial.begin(9600);
}

void loop()                     // run over and over again
{
  while (Serial.available())
            {
              i++;
              if (i == 1) {
                iValue = 0;
                }
              c = Serial.read();
              
              if(c < '0' || c > '9') return;
              
              iValue = iValue * 10 + (c-'0');
              Serial.println(iValue);
              }

              i = 0;
  
 
  
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(iValue);                  
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(iValue);                  

}