Light Sensor and LED Problem - LilyPad

Imagine that "lightval" has the value 1007.
What value does that give to "brightness"?

You haven't told us how the LDR or LED are wired.