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 bcf1d08 commit ab82347Copy full SHA for ab82347
src/components/ledc/ws_ledc.cpp
@@ -54,7 +54,8 @@ bool ws_ledc::analogWrite(uint8_t pin, int value) {
54
55
// Calculate duty cycle for the `value` passed in
56
// (assumes 12-bit resolution, 2^12)
57
- uint32_t dutyCycle = (4095 / 255) * min(value, 255);
+ //uint32_t dutyCycle = (4095 / 255) * min(value, 255);
58
+ uint32_t dutyCycle =(uint32_t)(((double)12 / 255.0) * min(value, (uint32_t)255));
59
60
// Call duty cycle write
61
return setDuty(pin, dutyCycle);
0 commit comments