How can I write an analog voltage on arduino?
There are 3 options:


Put a low-pass filter on the PWM pin so that only the very low frequencies in the signal generated by the PWM, which will be at approximately the equivalent analog voltage, are allowed through.
Connect a separate DAC to the Arduino, either serial or parallel, in either integrated or discrete resistor ladder form.
Use an Arduino that has a DAC built-in, such as the Arduino Due.