Adding code to PWM LED dimming

It would help if you posted the complete original program and not just a section of it.