I have no formal programming education. I taught myself Commodore (PET) basic in1980, then dbase, but hit the wall 15 years ago when I assaulted visual C++ My mind set if top to bottom execution. Four or five years ago, working with Arduino IDE became my AA project ("AA" stands for - Anti Alzheimer's)
I want to sequence three sets of colored LEDs under the wings of my RC plane. after 10 or so sequences I want to light up a circle of 6 white Leds, in pairs, to appear as they are spinning at the front of the plane. The LEDs will be powered via a transistor controlled by the Nano. I got it to work using Delay(), but that precluded them lighting independently. So enter "millis()"
The colored leds are on digital pins 10,11 and 12. The white ones are on digital pins 7,8, and 9. After multiple failures, I got millis() to sequence through pins 10,11 and 12. After 10 cycles of 10,11 and 12, I tried to add pins 7,8 and 9. That is when things went south... 7,8 and 9 sequence twice while the colored ones continue. But after the second cycle they go out. Then after a bit pin 9 lights up and stays on.
I used Serial.print to try to follow what was happening. After the second cycle, it seemed random.
I will try to upload the sketch here. Well I guess I donot have the privilege to upload, so I will try to copy and paste.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags. Code without indentation is much more difficult to read and follow.
Please go back and fix your original post. Code posted in a code block is easy to copy to the IDE or other text editor for examination and verification.
Use descriptive names for functions, variables and pins. Single letter variable names is so 80's.
I think the "random" effect you are seeing is actually not that random.
There are a couple of errors in your code...
1). You increment this counter twice in the same loop. Just do it once.
2). You zero cycle10, when cycle9 is zeroed... this causes the full sequence to start over with just the colored LEDs lit. You don't need to reset cycle10.
General comments.
Your code is difficult to read/understand because you have poorly chosen variable names. Don't call things cycle10, or millis9... use something like coloredCount or whiteStartTime.
When using millis don't use...
...use millis() - millis9 >= wait9
They may appear to be identical statements, but only the latter will work correctly when millis eventually overflows.
Due to multiple trial and errors, the code got very cluttered. The sketch is very short, so I am going to start over using the great info you all have given. And yes, getting away from single letter variables is difficult, old habits die hard. Back in the 80's I started writing programs in commodore basic with 8k of ram to work with. Each character in the code came at a cost
I get it about the variables. I started coding in the mid '70s using Fortran. Then several brands of BASIC. Giving good descriptive names to variables and function goes a long way to commenting your code.
I finally pulled my head out of the pine needles and sawdust. Threw out the first try. Broke it down into two sketches, got each to work then put them together... Thanks for your help. Now to start cutting foam, building the plane and soldering things together...
I edited my first post above, but I do not think I got the working sketch up there correctly.