-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Hi,
Thanks for the library, now that I've got it working it's very handy!
It's taken me several hours to get it working though - I was having a silent failure where the LED simply didn't do anything when in my program, but the examples worked. After a lot of back and forth adding and removing code, I traced it down to having pinMode(PIN_LED_BLAH, OUTPUT);
inside setup()
. It's now obvious to me that this code runs after the initialization in the constructor and detaches the ledc output, but given the prevalence of such bootstrapping code in classic Arduino, combined with this library eschewing the construct-then-begin()
pattern for attaching to a pin and therefore initilizating earlier than setup()
, it might be good to point out in the FAQ or elsewhere in the docs that if the LED is not responding to make sure there isn't a stray pinMode()
or digitalWrite()
on the same pin elsewhere in the program - either appears enough to permanently detach the ledc output.
In my case I was migrating from a custom method of blinking the LED, so the setup code was there prior to installing the library.
FWIW this is on ESP32, and may not happen on other HALs that back on to analogWrite
instead.
If you prefer, I can submit a PR for the readme.
Thanks