[SOLVED]Serial input affecting a delay

[uncompiled, untested]

#define OPTO 13 // optocoupler pin
int pause; // variable for our blinks

void setup()
{
 Serial.begin(9600); 
 pinMode (OPTO, OUTPUT);
}

void loop ()
{
  if (Serial.available() >0 ) {
    int val = Serial.read(); // only reads the first byte of data
    pause = map (val, '0', '9', 15, 100); // hence maximum of 9
    pause = constrain (pause , 15, 100); // only needed if you don't get '0' to '9'
  }
 
  digitalWrite(OPTO, HIGH);
  delay(pause);
  digitalWrite (OPTO, LOW);
  delay(pause);// check the sensors
  Serial.println (pause);
}