Controlling a small motor can be very simple. If the motor is small enough, it can be directly connected to the Arduino pin, and simply turning the pin to HIGH or LOW will control the motor.
This recipe will teach you the basic logic of how to control a motor; however, this is not a typical way of connecting a motor to the Arduino. It is recommended that you first understand this recipe and then apply the following one, Controlling motors with transistors.
Following are the ingredients required to execute this recipe: