In SC-Timer/PWM I am working with addressable LEDs to control LED colour by generating on and off pulses. In the handler function, initializing the variable count1 which increases its value. For example, if count1 is 18 the pulse should be 18 but I am getting one extra pulse as 19 which recognises with single long pulse generated from one duty cycle to another duty cycle. Kindly suggest some solution for the issue.
I have attached below the txt file of the code and the image of the pulse for your reference.