Bh1750 lux sensor question

What do you mean, "store the value" ?

You are reading the value from the sensor repeatedly, and it is going into your variable "val".

Do you only want to take one photo, the first time the light level reaches your specified value ?