HSGD1:
The idea is, using an LDR, every time it senses the light has gone down, it will add 1, and then every time it goes down again it will add another 1.
Can you be more specific about "goes down"?
Is that every step less of the 1024 'analog' steps? If so, don't bother adding 1, value = 1023 - reading.
Or is that every time there is a decrease that halts for some minimum time? And then the next, etc.
LDR is slow compared to a phototransistor. The latter costs more but shop a bit and get a bunch for $1.