Arduino + Processing + Servo control

I have written some code on arduino and in processing to control a servo with my keyboard, however there is almost a one second delay from when i press my key to when the servo moves. I know its not my computer because when i press a key the RX light on the arduino lights up instatnly. So is it my code?
Processing code

import processing.serial.*;

Serial myPort;

void setup()
{
  myPort = new Serial(this, Serial.list()[4], 9600);
  println(Serial.list());
}


void draw()
{
}


void keyPressed() {

  switch (key) {

  case 'w':
    myPort.write('w');
    break;

  case 'p':
    myPort.write('p');
    break;

  default:
  
  }
}

Arduino code
#include <Servo.h>

Servo servo;

int servoPos = 0;


void setup(){

  Serial.begin(9600);

  servo.attach(9);

  servo.write(0);

}


void loop(){

  char c;

  if (Serial.available()){

    c = Serial.read();

  }

  switch (c){

  case 'w':

    servo.write(servoPos+=10);
    delay(1000);
    break;

  case 'p':
    servo.write(servoPos-=10);
    delay(1000);
    break;

  default:
    break;

  }
  if (servoPos == 180){

    servoPos = 0; 
  }
}

Thank you!!

Have you tried removing the delay(1000);statements?

  char c;

  if (Serial.available()){

    c = Serial.read();

  }

What random garbage is in c if there is no serial data to read?

  switch (c){

Why are you acting on that random garbage?

Thanks hacksribble i cant belive i didnt see that! i thought i took it out! And for paul, are you stupid? If you saw the processig sketch there was something for it to read everytime i pressed 'w' or 'p'

Why would the delay(1000); [u]after[/u] the servo.write() cause a delay before moving the servo ?

As for what is in c, it is declared each time through loop() and hence will have garbage in it if nothing has been received.

And for paul, are you stupid?

You've got the wrong one of us tagged with the stupid tag.

the delay (1000) actually was the problem because it worked perfectly first time i pressed but since i had the delay all the other presses were delayed makeing me think there was something wrong when there wasnt. And as for the garbage in c how would i do it so i wouldnt get garbage?

Thanks!

And as for the garbage in c how would i do it so i wouldnt get garbage?

Assign c a value when you declare it:

char c = ' ';