looping question

I am trying to understand how to get this section of code to loop. Please explain what I must do/add and why.
Thanks,
-jim

void loop(){ 
   
   while(delayValue >=20){
        delay(delayValue);
        digitalWrite(led1, HIGH);
        digitalWrite(led2, HIGH);
        digitalWrite(led3, HIGH);
        digitalWrite(led4, HIGH);
        digitalWrite(led5, HIGH);
        digitalWrite(led6, HIGH);
        delay(delayValue);
        digitalWrite(led1, LOW);
        digitalWrite(led2, LOW);
        digitalWrite(led3, LOW);
        digitalWrite(led4, LOW);
        digitalWrite(led5, LOW);
        digitalWrite(led6, LOW);   
        delayValue-=20; 
   }
  
  int x;
  for(x = 0; x < 65; x ++){
    
    digitalWrite(led7, HIGH);
    digitalWrite(led8, HIGH);
    digitalWrite(led9, HIGH);
    digitalWrite(led10, HIGH);
    digitalWrite(led11, HIGH);
    digitalWrite(led12, HIGH);
    delay (30);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
    digitalWrite(led9, LOW);
    digitalWrite(led10, LOW);
    digitalWrite(led11, LOW);
    digitalWrite(led12, LOW);  
    delay (30);
 
}}

What is delayValue at start and I guess when that's done there's no need to "recharge" it?

Some more details would be helpful.

There are three loops in your code. Which one are you having trouble with?
Assuming that it is this loop:

   while(delayValue >=20){
        delay(delayValue);
        digitalWrite(led1, HIGH);
        digitalWrite(led2, HIGH);

What is the data type for delayValue? What is its initial value?

Tell us what you are really trying to do!. Your code makes no sense at all!

Mark

He's (or she's?) making 6 leds blink first faster and faster (than initially WHAT is not revealed) and then a bunch of 30 ms blinks that repeat while the first sequence does not.

Should I leave a hint about writing a whole Port at a time? Oh... wait....

OK, sorry to not be sufficiently clear. If my code "makes no sense" it explains why I'm here asking politely for help.

The code has a section where the leds advance in frequency up to a point. Then the 2nd section of quickly pulsing leds follows for a number of repeating times. I simply want the code to then go to the top and repeat.

Id also like to know that I can insert this section of code into others. I think my confusion stems from not understanding the use of brackets {}.

Thank you,
jim

And I still have the same question and observation.

GoForSmoke:
What is delayValue at start and I guess when that's done there's no need to "recharge" it?

How about post the COMPLETE code and I can see the answer to the question?

int led1 = 1;
int led2 = 2;
int led3 = 3;
int led4 = 4;
int led5 = 5;
int led6 = 6;
int led7 = 7;
int led8 = 8;
int led9 = 9;
int led10 = 10;
int led11 = 11;
int led12 = 12;

long delayValue = 500;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.

pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);
pinMode(led8, OUTPUT);
pinMode(led9, OUTPUT);
pinMode(led10, OUTPUT);
pinMode(led11, OUTPUT);
pinMode(led12, OUTPUT);

}

void loop(){

while(delayValue >=20){
delay(delayValue);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
delay(delayValue);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
delayValue-=20;
}

int x;
for(x = 0; x < 65; x ++){

digitalWrite(led7, HIGH);
digitalWrite(led8, HIGH);
digitalWrite(led9, HIGH);
digitalWrite(led10, HIGH);
digitalWrite(led11, HIGH);
digitalWrite(led12, HIGH);
delay (30);
digitalWrite(led7, LOW);
digitalWrite(led8, LOW);
digitalWrite(led9, LOW);
digitalWrite(led10, LOW);
digitalWrite(led11, LOW);
digitalWrite(led12, LOW);
delay (30);

}}

I'm not going to wire up 6 leds to test it but that code looks like it should run through the faster and faster blink part once and then do the fast blinks over and over.

The first time through the slow to fast blinks, delayValue is reduced until the loop exits.
And delayValue is never made > 20 again so while(delayValue >=20) is never TRUE again, you get the picture?

Your fingers would benefit wildly by learning the Array example in your IDE. You can load it through the File menu.
File->Examples->05.Controls->Arrays

The first time thru the loop() function, delayValue = 500 and the while() loop will behave as expected. The second time thru the loop() function delayValue < 20 so the while() loop does not run. Try this instead of a while() loop…

for (delayValue=500;delayValue>=20;delayValue-=20) {
  // yada yada
}

It's good to practice all the control structures to where you know them and how to use them well so that when you later face a new problem you won't be thinking in limited terms.

IIRC a while loop is actually a tiny bit faster than a for-next.

// initialize values then
while ( conditions checked in order to run, may not run at all, kind of an "if loop")
{
// vary values
}

do // runs at least once every time
{
// vary values
}
while ( conditions checked in order to keep looping );

for ( initialize conditions; check to run; change every time )
{
}

You can also use labels and goto but that's a bad idea.

And not to forget how to stop an Arduino:
while ( 1 );