read first character from serial

Hi, how i can read first char from serial, and send valuest after char to pin?
Example: I send to arduino H1234, arduino get it, and send 1234 to pin 13, next I send to arduino Z7239, arduino get it, and send 7239 to pin 12
Here is my code, working only 13 pin.

int thr = 13;
int pitch = 12;
int roll = 11;
int yaw = 10;
int aux = 9;
int val;                           

void setup()
{
  Serial.begin(9600);              
  pinMode(thr, OUTPUT);      
  pinMode(pitch, OUTPUT);
  pinMode(roll, OUTPUT);
  pinMode(yaw, OUTPUT);
  pinMode(aux, OUTPUT);  
}

void loop()
{
  if (Serial.available()) {         
    val = Serial.read();            
      digitalWrite(thr, HIGH);
      digitalWrite(thr, val);
      digitalWrite(thr, LOW); 
      delayMicroseconds(500);
      digitalWrite(yaw, HIGH);
      digitalWrite(yaw, val);
      digitalWrite(yaw, LOW); 
      delayMicroseconds(500);
    }
  }

Can you explain what you mean by

and send 1234 to pin 13

, please?

sending to serial HVALUE1 ZVALUE2, a want to get VALUE1 on pin 13, and VALUE2 on pin 12

limanad:
sending to serial HVALUE1 ZVALUE2, a want to get VALUE1 on pin 13, and VALUE2 on pin 12

where ?

post the loop() as well, maan.

sending to serial HVALUE1 ZVALUE2

Sending FROM where? is the correct question.

If you are using the Serial Monitor application to send data, it is sending strings. If you send "H1234", sending 'H' to the LED hardly makes sense, any more than sending '1', '2', '3', or '4' does.

Misunderstanding. I need to do 6 channel controller to control ESC by Multiwii on my atmega2560, so i want to send command via serial from my wifi router to arduino mini, and want to separate channels. If there is H1234 sended, the controller reads its an H and send the value next to H (in this example is 1234) to digital pin 13, and if i send Z1234, controller reads first Z and send next digits to anoter pin (12 or else)

send the value next to H (in this example is 1234) to digital pin 13,

The bit we don't understand is how you send 1234 to pin 13. Pin 13 is a digital pin and can only be set high or low so setting it to 1234 makes no sense at all.

i need to send delayMicroseconds(value) different for each pin

limanad:
i need to send delayMicroseconds(value) different for each pin

No sorry still making no sense.
Do you mean you need to send that pin high for that number of microseconds and then send it low again?

Yes, Grumpy, i want that.
I just trying to understand this Google Code Archive - Long-term storage for Google Code Project Hosting.

So what you really want to do is to generate a PWM signal with the mark period ( that is high ) as the value you send through the serial port and the space value ( that is low ) at what period?

You need to use the code that says:-

a small example for a interrupt driven soft PWM code

Then you need to read the ASCII string. There is a page on that but I don't seem to be getting it at the moment but here is the google cache :-
http://webcache.googleusercontent.com/search?q=cache:0HqsGlobZIEJ:arduino.cc/en/Tutorial/ReadASCIIString+&cd=3&hl=en&ct=clnk&gl=uk&client=firefox-a

Grumpy_Mike:
So what you really want to do is to generate a PWM signal with the mark period ( that is high ) as the value you send through the serial port and the space value ( that is low ) at what period?

You need to use the code that says:-

a small example for a interrupt driven soft PWM code

Then you need to read the ASCII string. There is a page on that but I don't seem to be getting it at the moment but here is the google cache :-
http://webcache.googleusercontent.com/search?q=cache:0HqsGlobZIEJ:arduino.cc/en/Tutorial/ReadASCIIString+&cd=3&hl=en&ct=clnk&gl=uk&client=firefox-a

Oh, thank you for this, now i will start learning this, it really make me happy.