Go Down

Topic: AnalogWriteResolution error? (Read 311 times) previous topic - next topic

Adrianotiger

Hi,
I was reading the reference for this function and saw this code:
Code: [Select]

// change the PWM resolution to 4 bits
   analogWriteResolution(4);
   analogWrite(13, map(sensorVal, 0, 1023, 0, 127));
   Serial.print(", 4-bit PWM value : ");
   Serial.println(map(sensorVal, 0, 1023, 0, 127));


https://www.arduino.cc/en/Reference/AnalogWriteResolution

Shouldn't be the value 15 instead of 127?
Code: [Select]

// change the PWM resolution to 4 bits
   analogWriteResolution(4);
   analogWrite(13, map(sensorVal, 0, 1023, 0, 15));
   Serial.print(", 4-bit PWM value : ");
   Serial.println(map(sensorVal, 0, 1023, 0, 15));


Adriano

Koepel

Yes, I think so. It should be 15.

Adrianotiger

#2
Sep 29, 2016, 02:18 pm Last Edit: Sep 29, 2016, 02:26 pm by Adrianotiger
After 3 months the bug on the webpage is still present.

Why add the link"report error" if this will not be reported?

pert

I have notified the Arduino developers of this issue:
https://github.com/arduino/Arduino/issues/5428
They usually don't read the forum, which is probably why the issue has not yet been fixed.
Thanks for reporting this issue Adrianotiger!

pert

The example code on the analogWriteResolution reference page has now been fixed. Thank you Adrianotiger!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy