I'm trying to create the program so that a LED flashes to show the system works then when it turns dark the first LED turns solid, and after 2.5 mins the second LED turns on and after 5 mins the final LED also turns on. When it becomes light again I need the system to reset to the flashing LED, ready for it to turn dark again. I'm quite new to Arduino. So far I have this:
You don't have a generic sensor attached to this pin, do you? More likely, you have a very specific kind of sensor attached. The variable name should reflect the actual sensor attached.
It's less obvious why this matters when you have just one sensor, but start adding a temperature sensor and a PIR sensor, and other sensors, and keeping track of what is attached to sensorPin1, sensorPin2, and sensorPin3 requires a cheat sheet. Keeping track of what is attached to tempPin, lightPin, and motionPin can generally be done without a cheat sheet.
So far I have this:
Which does something. You haven't explained what.
You have one second delays in there. They don't match your thread title/requirement times.
Ahh the sensor is LDR. How do I go about changing the name of the sensor to lightPin? Sorry about that, the program currently flashes on for 1 second and off for 1 second if it is light. When the LDR is covered and it becomes dark the LED stays on during darkness. I don't know how I would go about now activating the 2nd LED after 2.5 mins of darkness and the 3rd LED after 5 mins of darkness. And then having the program reset to just the 1st LED flashing when it is light again.
How do I go about changing the name of the sensor to lightPin?
Highlight the name, and type a new name.
I don't know how I would go about now activating the 2nd LED after 2.5 mins of darkness
You need to record when the event of interest occurs (the light level falls below some value). Then, separately, on every pass through loop(), you see if it is dark (the light level is below some value) and if is has been dark long enough. If it has, turn the appropriate LED on.
The state change detection example will bear looking at, so you can tell "it just became dark" (so you need to record the time) vs. "it is dark" (and has been for 1 minute, 2 and half minutes, 3 hours, etc.).
The blink without delay example will bear looking at, so you can see how to do things at specific intervals after other things happened (2 and a half minutes after it got dark).
Edit: Fixed the quote that failed to copy correctly.
I never said there wasn't a problem. But, the array bounds issue you were alluding to (at least that's what I assumed you were alluding to) isn't the issue.
F**king windows. Ctrl-C doesn't work half the time. I need to pay attention to what I actually paste. I feel like going down the street and Ctrl-Ving someone...