help

Grkays, There are two things you are doing wrong. First you haven't finished the routine of what to do when the button is pressed. You should then loop until it is unpressed. Second you should define it as a function and call it every time you normally call delay(500).

Put this at the end of your sketch after the loop() function:-

void delayHold(int del){
 endTime = millis() + del;
while(endTime>millis()) {
  val = digitalRead(inputPin);
  if (val == HIGH) {
// hold until val == LOW
  while(val == LOW){
  val = digitalRead(inputPin);
  }
}
}
}

Now each time you originally had delay(500); replace it with delayHold(500);