We cannot interface a DC motor directly with our micro-controller board as we will end up blowing up our board due to the back emf generated by the motor. As for robotics hobbyists, generally two types of DC motors are available in the market, a 12v or a 6v DC motor. Therefore driving a 6/12v device from a 5v micro-controller will lead to driving of a large amount of extra current from the device leading to burning up of its circuitry.In order to prevent the board from blowing up, we normally use an H-bridge to drive and control a motor from the micro-controller board. H-bridges use the direction of flow of current to drive and control a DC motor, as is shown in the figure below.But H-bridges suffer from the problem of complexity of the circuit.
Hence, in order to address this issue, L293D- a dual h-bridge motor driver IC was introduced. With one such IC, we can interface 2 DC motors which can be controlled in both clockwise and anticlockwise direction. Datasheet can be found here.
Just follow the schematic and the truth table shown below to interface a motor with L293D and you will be good to go.