sample hold

Basically i would like to sample the voltage (the voltage is constant change) value on one analog in pin every time i press a push switch, and then hold that value until next press. The hold value would be outputed by a pwm pin.

Anyone knows of a simple exemple code for this?

regards,

rensberl:
Anyone knows of a simple exemple code for this?

Yes I do to some extent. Not sure what you mean by output a certain analog Voltage on a pin, basic Arduino don’t have a DAC

what have you tried ?

There are tutorials to detect a button pressand to read an analog Value. Start there and print the what you read when you press the button.

Post that code and we will help