Yes it's curious ;-)
The eye is averaging the output brightness from the led, while at the same time it is also working on the principle of persitence of vision, POV, and the two effects combined mean there will be little hope of seeing a true linear change. It may be achievable in the long run but as soon as the observer changes their head position, or look at the led from a different angle, the flicker will be more noticeable and then the effect will not be accurate, or linear, again.
I build display devices which regularly use crossfading effects between digits and wether I use filament bulbs, neon nixie tubes or leds or VFD's, a linear voltage change always produces a non-linear change in brightness. See Youtube video as an example.
Another thing to consider too, is that as your eye sees a light source which has an increasing brightness it reacts by closing down the iris and therefore it 'spoils' the effect you thought you were going to see, but we all experience this effect 'similarly' and are accustomed to it.
The code posted in the first message should run 'linearly' no matter what the PWM duty cycle is set at, because even with a small on time the PWM routine should be padding the rest of the time period with a respective amount of offtime to produce a fixed PWM period
Chris
Bookmarks