Hi All,
I'm getting some strange behavior with this, that maybe somebody could help with please?
The purpose of the code is to cycle sequentially though 11 different configurations, with each configuration (I call it a crank position) calling for 3 out of 11 PWM channels to be active. A different 3 channels for each crank position. I don't have much experience of using timers, or coding in general.
The behavior I am trying for is that the crank position should cycle through positions every 50ms then when it gets to position 11 should go back to position 1, so a cycle time of 550ms overall. The problem is that I am not getting PWM on the last 3 PWM channels (8,9,10).
I checked things in general before introducing the Crank feature by just pulsing each channel simultaneously and attaching to LEDs and that worked fine, so I now I'm connected to pins that can be PWM'd. I don't have a scope unfortunately.
I can see that the correct If statement is being entered into in all cases but for some reason the PWM output on those channels 8, 9 an 10 is not pulsing in order like the rest. They are a constant 1.5-1.6V.
I have tried simpler ode without a timer, that simply fades the PWMs on those same 11 channels simultaneously, and that works completely fine. I have also tried a different piece of ESP32 based hardware and get the same problem.
I was using a switch statement before to handle the different cases, but have changed that to If statements just to check it wasn't my use of that somehow (t didn't make a difference). Below is the ode as it stands at the moment. am grateful for any suggestions on things to try to help narrow down the problem.
Message too long to fit the code in.... have added as a txt attachment.
ESP32PWMCyclingTest.txt (11.1 KB)