Closed Findus76 closed 1 year ago
ledcAttachPin is going to set the pin mode (it is going to use the ledc peripheral, rather than digital out). Don't set pinMode after you attach it.
Many thanks. That was the mistake. Now it works. I was unsure when I created the code about 2 years ago, it became a bit of "double security" and has worked.
Undefined behavior sometimes works, but is subject to change when the APIs change. Following the examples in the repo should give you better results than random (old) internet code...
Board
ESP-WROOM-32, custom board
Device Description
Custom board. 4 pcs pwm outputs, 0-10V out, digital in, analog in, I2C, onewire.
Hardware Configuration
PWM connected to base of fet transistor. 0-10V, averaged in files and amplified with OP amplifier.
Version
v2.0.6
IDE Name
Platformio IO
Operating System
Windows7
Flash frequency
40
PSRAM enabled
no
Upload speed
115200
Description
The unit has been running flawlessly for almost 2 years. Upgraded the kernel first to 2.0.5 then to 2.0.6. Since then the PWM and 0-10V outputs do not work. Have measured with an oscilloscope, the outputs are constantly at 0V. Have tried -To read back the status of the pins if they are still output, they are. -To read back (ledcread) which reports the previous set value... Ie start value 0 I set 100 and I read back 0, I write new value 60 and I read back 100. -To put several ledcwrite after each other. Does not make a difference on the pin, however, it can read back the data correctly. Not always but sometimes. -Moving initiation of ledcsetup and ledcattatch from constructor to a begin function no difference.
Sketch
Debug Message
Other Steps to Reproduce
case #5306 feels similar.
I have checked existing issues, online documentation and the Troubleshooting Guide