When using microcontroller and want to drive motor control or control led intensity you can use DAC to generate analog output voltage. But there is an easier way of doing this. You can use digital output to reach same results. This technique is known as PWM -Pulse Width Modulation.
In this picture you can see 50% duty cycle square wave form. The width of ‘0’ is equal to ‘1’ level, this means if signal amplitude is 5V, then average voltage over one cycle is 2.5V. It is as though of hawing constant 2.5V voltage.
If you have 10% duty cycle, then your average voltage would be 0.5V.
You should use low pass filter to convert pulses to analog voltage:
This is like digital to analog converter without DAC.
You can use PWM to drive LED to change light intensities. Also it can be used to generate audio by changing frequency of duty cycle. DC motors can also be controlled effectively by PWM.