As above. Use millis() for the "Wait a while" timing
See Using millis() for timing. A beginners guide