Here is a very good example on how to control a small DC motor with an H bridge and an Arduino board.
The speed of the motor is controlled by the Analog output of the Arduino. A switch controls the direction of rotation. Here is the demo video
You can find the code in this link