Motor reversing after a certain time period

Hi there

I am a complete and total newb to Arduino and programming in general so I hope you guys can help.

I basically need to create a circuit that when turned on spins a motor one way for approx. 10 seconds then switches its direction and spins the motor the other way for 10 seconds then stops. I used the tutorial below and am able to make the motor spin and reverse, but I need it to be timed and then stop.

Any and all help is greatly appreciated!

Study the Blink Without Delay example that is provided with the Arduino IDE. That will show you how to time events.

Be sure to declare all variables associated with millis() to be unsigned long.

The demo Several Things at a Time is an extended example of BWoD.