I’ve managed to make a PWM output supply a voltage through an RC filter quite well on a Nano.
I am using the code to generate a RPM value in thousands of revs. That value is then converted to make 2000 revs per volt on the RC filtered output.
Code line that displays revs per volt is;
analogWrite (outPin1, ((rpm_val/2000) * 255)/5);.
I use 2000 because I want it to limit at 10000 revs (5v).
Ive tested it by replacing rpm_val with numbers from 1000 to 10000 which is the max I need.
At 10,000 it limits at 4.5v and I ideally need it to run to 5v to feed a bar graph driver.
if I change the 255/5 to 255/4.5 (or any other number) it doesnt make any difference. Bit new to this…