Unless you have all the time of the world, I would not recommend this way.
LEDs are current controlled devices. PWM is controlling the mean voltage that the LED receives. So, I think the way you try it is wrong.
You have to control, by the PWM signal, the current flow through the LED.
Then, you only have to find the min and max current the LED needs to light. Rest should be close to linear.
Ioannis
Bookmarks