Despite the "analogWrite" function name, PWM is not actually an analog output (it's actually just switching the pin on and off really fast). You can convert PWM into an analog output by adding a smoothing circuit, such as a simple RC filter.
pert:
Despite the "analogWrite" function name, PWM is not actually an analog output (it's actually just switching the pin on and off really fast). You can convert PWM into an analog output by adding a smoothing circuit, such as a simple RC filter.
Yes, but can it do this simultaneously on both pins?
Yes. It can do that. PWM is done in hardware so you can set a PWM value via analogWrite() and then that pin will continue to output the PWM signal no matter what else your code is doing until you write to that pin again with analogWrite().