*urgent have a couple days to get assignment done* looking to make a aurduino r4 uno minima photoresistor activating servoarm

You might want to look at this How to get the best out of this forum before you proceed any further.

It tells you how to post code correctly here.

That is way too long, and also unnecessary, plus it means that you will miss many lightning strikes.

Are you detecting visible lightning strikes with a photo diode? That is not the right way to do this. You should use an electromagnetic sensor like an antenna, or a FM radio tuned to a station with no reception. There are many proper detector circuits on line.

What does the servo do and why?

Why is this request urgent?