diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index ff356b41f948e00176561271f0c3a9035fe6b26c..5ccf3236d6b1fca1f34f10fe26b9bd78f6a4c0de 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -260,10 +260,13 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue ) break ; } + ulValue = mapResolution(ulValue, _writeResolution, 8); + // Set PORT if ( isTC ) { // -- Configure TC + // DISABLE TCx TCx->COUNT8.CTRLA.reg &=~(TC_CTRLA_ENABLE); // Set Timer counter Mode to 8 bits