Maurizio show us how to generate an analog voltage using a microcontroller and some resistors.
The purpose of this article is how to generate analog voltage with digital circuit. Although the market provides today a very broad range of dedicated digital-to-analogue converters, putting such a device in the schematic has a negative impact on the overall cost of the system. There are however, cheap methods of creating the required voltage levels, and even of generating pseudo-analogue signals, using purely digital means.
Generating Analog Voltage with Digital Circuit – [Link]