PS-2 keyboard - key is hold

Hello,
it's my first topic.
I have big problem. I'm building hexapod robot and I need keyboard to drive it. I've written arduino program: it's PS2keyboard/Simple_Test, without serial output but with servo.h library. When i press 'w' one of the servo motors moves. It works properly as soon as I don't press button too long.
How can I edit code? Effect should be the same as if I use microswitch and if().
For instance:
if I press button 'w' for about 5sec - servo moves:

     ser[4].write(60);
     delay(500);
     ser[4].write(120);
     delay(500);

if button is not pressed - servo stops and there is no queue or sth like this :cold_sweat:

Full code:

#include <PS2Keyboard.h>
#include <Servo.h>

Servo ser[21];
PS2Keyboard keyboard;
int poz[21] = {90};
const int DataPin = 2;
const int IRQPin = 3;
char key = 0, inkey = 0;

void setup()
{
  ser[1].attach(53);
  ser[2].attach(45);
  ser[3].attach(44);
  ser[4].attach(47);
  ser[5].attach(46);
  ser[6].attach(49);
 //7-19
  ser[20].attach(34);
  
  for(int i=1; i <= 20; i++)
  {
    ser[i].write(90);
  }
  
  delay(1000);
  keyboard.begin(DataPin, IRQPin);
}

void loop()
{
  if(keyboard.available())
  {
    key = keyboard.read();
  }
    if(key == PS2_ENTER)//up with one leg
    {
     ser[5].write(120);
     ser[6].write(60);
     delay(250);
    }
    
    if(key == 'w')//forward with one leg
    {
     ser[4].write(60);
     delay(500);
     ser[4].write(120);
     delay(500);
    }
    
    key = '0';
}

I'm using ARDUINO MEGA 2560, keyboard: pin 2,3, servo 47,46,49.

Servos and keyboard have separeted source of energu - lead battery, 6v, 4.5Ah, hight discharge.
Keyboard source with one diode to decrease voltage.

Please help me :frowning:

Read this
http://arduino.cc/forum/index.php/topic,97455.0.html