Very basic--how to turn DC motor on and off?

I'm an absolute beginner, and I'd like to know how to set up a circuit and program my Arduino to run a small DC motor (from a Knex toy) and just turn it on and off repeatedly, with delays (I don't need to control it, just turn on and off every second or so). Can anyone help?


How much current does this motor draw? If it's less than 20mA, you can connect it directly to a digital pin, and turn that pin off and on.

If it draw more than than, a transistor or relay will be needed. Those can be turned on and off using a digital pin, and they can, in turn, turn the motor off and on.

Sorry for posting in more than one place–did you mean this? [attached]

Your transistor terminals are not identified so it is impossible to evaluate your diagram.

The diode should be in parallel with the motor and there should be a resistor in the transistor base lead.