KeithWalker
- Joined Jul 10, 2017
- 3,091
To invert the PWM signal takes one line of code:Yes, but as I said earlier a single device is inverting which puts the PWM 'upside down', so analogWrite(255) = 0 out and analogWrite(0) = 100% which is counter-intuitive, especially for a beginner! and by the time you've deployed 3 transistors or MOSFETs for a non-inverting push-pull output you might as well use a chip, its less wiring and more reliable.
A pmw DAC with an active multipole filter can be pretty clean on the output. An LC rather than an RC filter is another option. A single pole RC filter is a pretty poor filter.
val = map( val, 0, 256, 256, 0);