Closed
Description
Hardware:
Board: ESP32
Description:
Unable to light off PWM common anode RGB Led when setting value to latest value of range.
Old known issue of ESP8266 #5957 and now seen is Tasmota and my sample test program
The fix is described in comments of official sample code
But from logical working, having value going from 0 to 255 should means that 255 is full scale so always 1 and not having a little pulse. This does now works on ESP8266 with analogWrite(255) and comments have been updated to code according in this PR
// Per the Arduino docs at https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/
// val: the duty cycle: between 0 (always off) and 255 (always on).
// So if val = 0 we have digitalWrite(LOW), if we have val==range we have digitalWrite(HIGH)
I know it's not arduino but I think if PWM could work as is 0 (always off) and max range value (always on)
would be less confusing
my ledOff()
sample function with 256 does works, but should works with 255, much easier if we use an uint8_t
as scale range.
void ledOff() {
ledcWrite(LED_RED_CHAN, 256);
ledcWrite(LED_GRN_CHAN, 256);
ledcWrite(LED_BLU_CHAN, 256);
}