Indeed, an approach would be, using the PWM capabilities of your controller. You can generate a PWM waveform by using the analogWrite() function.
Parameters for your function:
pin: the pin to write to.
value: the duty cycle: between 0 (always off) and 255 (always on).
So, if your duty cycle is 255 that means you will have 5V, for 3.3V duty cycle should be somewhere close to 168.
However remember that "On most Arduino boards (those with the ATmega168 or ATmega328), this function works on pins 3, 5, 6, 9, 10, and 11".
All you need to know about this matter, you can find here http://arduino.cc/en/Reference/analogWrite
Anyhow, don't forget that when dealing with LEDs - polarity is important and also you should (actually must) have a resistor in the circuit so that the current is limited.
Just one more thing - analogWrite, as you may already know, does not use the digital to analogue converter - it uses the PWM capabilities of you controller. This is just FYI :)
Regarding the issue that you mentioned "To avoid unnessesary power/heat (even if not too much)" as Olin mentioned above, run you LEDs at low currents.
For a standard LED 20mA would be the nominal value. However 20mA is the "recommended" maximum output for your controller outputs :)
Solution: If you think 15mA is OK for the LED and your planning on feeding it at 5V (from a digital output pin) and considering that the diode forward voltage is, as you said, 3.3V use this right here http://led.linear1.org/1led.wiz and you'll see that you're gonna need a 120 Ohm resistor :) A bigger value would lead to a less brighter LED and a smaller value to a brighter one, but keep in mind that a too low value resistor will lead to your controller port being... fried :)
Plan using a lot of LEDs? Try a LED matrix approach, either way I think that what you want is the resistor version, not the PWM.
Good luck and all the best, sorry for the rusty english,
Dan
There is no real difference between an analogue power supply and a digital power supply. They are separated because the digital power supply will supply current to digital switches which will switch on and off rapidly, putting large current demand spikes onto the power line, and hence cause momentary voltage drops and spikes on the line - these spikes are managed by decoupling capacitors local to the switching devices, and bulk capacitance at the power supply.
By keeping the two supply lines separate the circuit designer can isolate these current spikes from analogue circuitry which may be affected by small voltage drops - for example if the supply is used as a reference for an A2D.
Often the two supplies are fed from the same source, but the analogue supply may have a small RC or inductive filter in line to remove digital noise present at the source.
So yes, the 3.3v pin of the STM32F4-discovery board could be used as an analog power source. I would just add a small series resistor (less than 0.05V drop at the current you are using) and additional capacitance to ground - to give a first order low pass filter frequency of about 1KHz - or whatever you deem appropriate.
Best Answer
Assuming you mean that you have an analog voltage at the input to a digital gate, then (as already noted) it will sense a 'low' from Vss (usually ground) up to some threshold and a 'high' between some other voltage and Vdd (some positive voltage for most families of logic). Between these voltages the input is indeterminate; i.e. what the input is sensing cannot be guaranteed. The actual threshold is somewhere between the stated guaranteed levels, and varies significantly across batches and temperature.
The issue does not end here, however: if you are feeding a slow input (slower than perhaps 20 nsec / volt) to a CMOS gate, the part will experience significant class A conduction (i.e. both the input stage transistors are on at the same time) and could burn the part out. This has happened to many a person, some of them quite experienced.
When I have a slow signal that needs to enter the logic domain, I use a Schmitt trigger device.
Do a quick search on the implications of slowly changing inputs on CMOS logic.