I need to have timed on/offs for multiple kinetic sculptures, and can’t use the DELAY(). I was looking a the millis() function, but not really clear on it. I was looking at some of the blinking LED examples, and had a difficult time figuring out what would work. The timed events need to occur over a 5 minutes, with 6 pins turning HIGH and LOW at different and various times. Any help would be met with gratitude… thanks
The millis function returns the elapsed time since the Arduino was restarted. Think of it as "now".
To turn LEDs (or SSRs) off and on at different intervals, keep track of when the LED (or SSR) is to be turned on or off, and use millis to determine what time it is now. Then, if it's greater than the time to turn an LED (or SSR) on or off, do that. When toggling the LED (or SSR), set the next time to turn it on or off.
Is the millis() function the "best" way to go in order to control multiple pins simultaneous at various intervals ? Are there other tricks to achieve this ?
There is a timed action library, on the playground, that might be useful. It uses millis to determine when to do things.