PaulS:
while(millis()-previousMillis[i]<=on){ //While current time (millis()) minus Previous time is less than ON TIME
digitalWrite(relayPin[i],HIGH); //Turn ON the relay(array)
}
This while loop blocks until the current minus the start time is greater than the on time desired. If that isn't the EXACT same thing delay does, I'll eat my hat.
What if i need to delay for longer than 1-5 minutes at a time? doesn't delay stops my code, for the certain amount of time? within that 1-5 minutes of delay(), i could be turning on a bunch of relays.
unless I am confused about the delay().
I think you should check the Timing section of the Playground. There are many libraries that allow you to setup different functions to be called at different intervals. Check out my SimpleTimer lib or the more advanced Time (which supports different "time sources", even i2c RTCs, with ease).
Thanks, I will try it out. I was wondering, for the SimpleTimer function you mentioned. How would i be able to use it in functions? can't seem to initialize it correctly to use for the function i made. or will i need to call it all within the void loop()?
Also, how would i be able to blink at different rates (1sec ON, 3min OFF) for your code:
timer.setInterval(1000, repeatMe);
since it only has the 1000, and it will blink at a constant rate.