ESP32-Dual-Core icon indicating copy to clipboard operation
ESP32-Dual-Core copied to clipboard

PWM ledcWrite() doesn't seem to work in a task

Open Salty-Doug opened this issue 7 years ago • 1 comments

Hi Andreas, your videos on the LED fade (PWM) and creating tasks and assigning them to a specific cpu core were really great and easy to follow. I am trying to make a temperature controlled forced-air furnace vent. I am using a 12vdc gear motor to open and close the louvers depending on the room temperature. I created a sketch that uses the ledcWrite(channel, duty) function as in your example. I works great. I then moved this code into a task and tried running on CPU 0 and CPU 1, but the motor doesn't turn on. I assume that it should work, I have looked the code over several times over days. Here are the two sketches. If you have a chance, please them over. Thanks in advance for help with this:

Working_Vent_Motor_Control_PWM.zip Non-Working_Furnace_Vent_Control_Two_Task.zip

Salty-Doug avatar Jun 23 '18 00:06 Salty-Doug

I fixed it. There was a typo in the ledcattachpin function for channel_1.

Salty-Doug avatar Jun 23 '18 03:06 Salty-Doug