How to set the output voltage of a pin

Hey, I was wandering is it possible to set Pin 13 for example as an output but instead of having the predefined voltage of high, can you change this value to 2V. What i am saying is can you change the output voltage of a pin (analogue/digital)? Thanks

can you change this value to 2V.

No. Pins are either on (5V or 3.3V, depending on which Arduino you have) or they are off.

Some pins can be used a PWM pins, where the time that the pin is on vs. off can be varied. Depending on what is connected to the PWM pin, it may see the voltage as varying in value, though it really isn't.

The PIC32 used on the ChipKit Uno32, which is largely compatible with a standard Arduino, has a DAC which can output any voltage between 0 and 3.3V.

Or you can use a voltage divider to lower the voltage.


Rob

Or you can use a voltage divider to lower the voltage.

Which will affect the current. What, exactly, are you trying to power using the output pin?

Or use an external DAC - either a DAC chip, of which there are many, or multiple digital outputs connected to an R-2R ladder.