analogWrite not functioning in if statement

Oh, I see now. Thank you!

Final question...it only increases brightness when the sensor checks. Is there a way to get around that without completely altering the (simple) structure of my code? Or will it just have to be tied to that delay?