New to Arduino.
I've been working on a project for my cosplay.
Trying to run multiple LED's with several different patterns.
LED 1, 2, 3, and 4 will be in a square. I'd like them to chase each other in a circle pattern. Each would turn on for one second before turning off as next turns out.
LED 5,6,7, and 8 will be in a square as well. Led 5 would turn on 1 second each on seconds 2 and 6. 6 and 7 would stay on accept on second 7. 8 would blink 1 second on 1 off.
A 9th LED will stay on and turn off for 1 second on second 1 and 5.
My question is...
Is it possible to start a millisecond counter that loops every 8 seconds?
Then use "if" to control each LED. Example:
If ((x >= 0000) && (x <= 999))
digitalWrite(Led1, HIGH);
If ((x >= 1000) && (x <= 1999))
digitalWrite(Led2, HIGH);
If ((x >= 2000) && (x <= 2999))
digitalWrite(Led3, HIGH);
If ((x >= 3000) && (x <= 3999))
digitalWrite(Led4, HIGH);
ETC.
I found a tutorial that almost works for LED 5 to 9. But it only allows me to start the PIN either HIGH or LOW and enter only 1 value each for HIGH duration and LOW duration. But doesn't use the delay variable so it runs all the led patterns (effectively) simultaneously.
I've spent hours reading tutorials, looking at YouTube videos and read half a book. And haven't been able to figure this out.
I tried using 4 pins with the tutorial sketch, each providing half the power to 2 leds each in different patterns:
PIN1: provide half power to LED1 & LED3 HIGH a 1000 milliseconds, 1000 milliseconds LOW starting HIGH.
PIN2: half power to LED2 & LED4, 1000 LOW, 1000 HIGH, starting LOW.
PIN3: half power to LED1 & LED2, 2000 HIGH, 2000 LOW, starting HIGH.
PIN4: half power to LED3 & LED4, 2000 LOW, 2000 HIGH, starting LOW.
This should have caused LED1 to receive full power (half from PIN1, half from PIN3) while LED2 and LED4 received half power each. Then PIN1 would turn LOW and PIN2 would switch HIGH GIVING full power to LED2 (half from PIN2, half from PIN3) while LED1 and LED4 received half power. Etc.
The LEDs claim they need 2.0 to 2.4v and 20mA. Since the arduino outputs 5v, I tried 470ohm resistors. But 3 LEDs light at all times with some brighter then others and the one off, switches between 2 and 3. (470 ohm should cut the 5v down to about 1v, 10mA which shouldn't be enough to light them.)
I'm not asking any one to write the sketch for me.
Just, is it possible to create a millisecond timer that loops every 8 seconds (from 0000 milliseconds to 7999 milliseconds), and use the "if" variable to switch Leds on at specific millisecond windows?
If it is, could you point me in the right direction of what functions to research?
I appreciate any and all help!