HELP ARDUINO CODE

If you want a responsive program there should be no delay()s as they block the Arduino from doing other things.

The demo Several Things at a Time illustrates the use of millis() to manage timing without blocking. It may help with understanding the technique.

Have a look at Using millis() for timing. A beginners guide if you need more explanation.

...R