Start stop with delay

Is this all your program needs to do?

These two tutorials should help:

StateChangeDetection
BlinkWithoutDelay