AnalogWrite creates a PWM when value is 255 #388
Labels
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
On legacy arduino platforms, when analogWrite value is 255, you get a DC/HIGH output (aliased to digitalWrite HIGH), see:
https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/wiring_analog.c#L110
While on UNO R4/renesas platform, 255 is converted to 255/256 and you get a PWM signal, see:
https://github.com/arduino/ArduinoCore-renesas/blob/main/cores/arduino/analog.cpp#L819
To match behavior, value should either be normalized to 255 ((1 << _writeResolution) - 1) or aliased to a digitalWrite as well
The text was updated successfully, but these errors were encountered: