Dear MOSREJLS,
Questions a bit vague!
Do you mean a RC model servo or a DC motor that you wish to use as a servo?
If you mean a RC servo then the servo pin may be driven directly from the PWM (pulse-width-modulated) output of a micro if it is operating at 5V. A 3V micro may require a level shifter to 5V (a single transistor hopefully).
The main problem is software - programming the PWM to produce a 20ms period waveform with a high-time of between 1 to 2 ms (from memory). Do a search on the web for a description of how RC servos work.
If you mean a DC-motor then its much more complicated and well beyond what could be described here.
bye
thats more of a hardware question than a compiler question...
But basically you need to connect a MOSFET or transistor to a pin on the MCU, and drive the MCU's pin with a pulsewidth modulator to controll the speed of the motor.
Now if you want the motor to run in both directions you need to use more transistors ( or MOSFETS) in an H bridge configuration and 1 or 2 more I/O pins to select the direction of said H Bridge and the PWM pin is used to determine the speed of the motor in the selected direction.