Controlling a DC motor for a certain amount of time

Two of the most common replies apply to you question.

  1. Use code tags when posting code!

  2. See blink without delay (examples) then look in the playground.

The other topic you need to look at is the Finite State Machine, again its in the playground.

Mark