I am new to programming and have a project of setting up an arduino to control 3 strands of leds. I have gotten them to loop so each strand will flash one at a time but once the last strand flashes I need all 3 of them to flashed together 3 to 4 times then start the cycle over. Below is the program I have so far can anyone please show me what to add to make this work correctly?
The outer loop will be the counter. The first inner loop will turn all the strands on. The second inner loop will turn all the strands off.
sorry. I did make a mistake. There should be another delay(timer); statement after the second inner loop. Otherwise the strands will be turned back on right away, and you will not notice them blinking off.
What your originally came up with is not what I refer to as the outer loop. It was a function definition containing a single loop to blink each light independently. That was good.
My "outer loop" is the for (int allBlink = 0; allBlink < 3; allBlink++) loop that you put into your code. It contains 2 other loops, one to turn on each strand, and one to turn off each strand.
You added a delay(timer); statement after the "blink each strand" loop which means there will be a slight delay after the individual blinks and all the mass blinks. I'm guessing you added this because of my comment about not being able to see the lights blink, but you put it in the wrong place. (It's not wrong to put it there--it might even be what you want--but it won't help you see the lights blinking.)
My comment about the missing delay(timer); statement still holds. In your mass blink loop (my "outer loop"), you do not delay between turning all the strands off and turning them on again. There should be another delay(timer); statement between lines 28 and 29 so you can see the blinking.
Thank you for your help with this. I finally got evertyhing together and it works good. I am running the leds off a 4 channel relay board. I have one channel left. If I wanted to as this into the program but to make it flash seperate from the rest would the programming needed to be added in basically be the same as the instructions to make pin13 blink from the Arduino wedsite?
I am not familiar with the Arduino stuff. I don't know anything about accessing individual channels on the board. I glanced at the web page, but didn't readily see what you were talking about. You can read that information as well as I can.
I think you have enough to figure out what you need to do. To blink a light, just turn it on, wait, and turn it off. To use a specific channel, copy from code you find on the web page.