The general solution is not to use the delay function. Look at the blink without delay example: http://arduino.cc/en/Tutorial/BlinkWithoutDelay
The general solution is not to use the delay function. Look at the blink without delay example: http://arduino.cc/en/Tutorial/BlinkWithoutDelay