-
Notifications
You must be signed in to change notification settings - Fork 7.6k
PWM: Further analogWrite broken after ledcDetachPin #7105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Ok, I see no reaction (1 week). Harald. |
@habazut Its on my list. |
I found one more bug in that corner. The first time you do
I recommend this patch instead which does put the values 0 to 15 into the pin array. Then it would be nice to have an API to get the channel/pin relationship so that it's possible to change the frequency on a pin. Or do a Greetings, |
Hi @habazut, I will take a look on the bugs and about the new API you mentioned, official Arduino don't have any of this, so why don't you just use our LEDC API without analogWrite? |
I use analogWrite() because this is supposed to work on AVR, ESP32, SAMD, STM32 without Regards, |
Hi @habazut, there is no bug in the analogWrite API.
About the |
@habazut PR created, please give it a try. |
@hazabut, The fix is in the
|
Board
ESP32 Dev Module
Device Description
Random Devkit
Hardware Configuration
Any GPIO than can do PWM
Version
v2.0.4
IDE Name
Arduino IDE
Operating System
Whatever
Flash frequency
Whatever
PSRAM enabled
no
Upload speed
Whatever
Description
The following sequence of function calls
analogWrite(pin, 128);
ledcDetachPin(pin);
analogWrite(pin,128);
does only give PWM once and not after the second call to analogWrite.
Problem: Internal conditional on pin_to_channel array prevents second ledcAttachPin.
Solution:
Apply inline patch and it works.
Regards,
Harald.
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: