8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d36e9bb commit 05a3de2Copy full SHA for 05a3de2
libraries/ESP32/examples/AnalogOut/LEDCSoftwareFade/LEDCSoftwareFade.ino
@@ -28,8 +28,8 @@ int fadeAmount = 5; // how many points to fade the LED by
28
// Arduino like analogWrite
29
// value has to be between 0 and valueMax
30
void ledcAnalogWrite(uint8_t channel, uint32_t value, uint32_t valueMax = 255) {
31
- // calculate duty
32
- uint32_t duty = (LEDC_BASE_FREQ / valueMax) * min(value, valueMax);
+ // calculate duty, 8191 from 2 ^ 13 - 1
+ uint32_t duty = (8191 / valueMax) * min(value, valueMax);
33
34
// write duty to LEDC
35
ledcWrite(channel, duty);
0 commit comments