For things that need to run for a set amount of time avoid delay() and instead use millis().
*edit- eried beat me to it.