LSR sketch

It seems the range of your input values may not be driving the full range of output values.

Here's something I'd try. First, do an experiment: print out "val" and see what values it assumes for the range of light your application needs. Read up on the map() command in the reference and use map() to map the input range to the output range 0..255 -- in place of analogWrite(…, val/4);

Good luck with your project,

-br