Voltage control with PWM-signal

Hi,

Can you post your entire sketch in one piece please.
If it won't fit in the code tags, please attach it so we can see it complete.
Can you also post a complete circuit diagram, including power supplies, sensor, MOSFET and gnd connections.
R1 in your original circuit should be 10K not 220R, it may be stopping any decent signal to the gate.
What is the output voltage controlling?
Tom.... :slight_smile: