Close the void loop ()

Dear guys / gals

I have read the forums but not sure / dont know how to approach the problem

This is how the code looks

Help me conclude so I can finish and close the loop

Thank you

void setup() {
  lc.shutdown(0,false);
  lc.setIntensity(0,5);
  lc.clearDisplay(0);  
}

void loop() {
  for (int i = 0; i<8; i++) lc.setRow(0,i,sf[i]); // Display sad face
  delay(1000);
  for (int i = 0; i<8; i++) lc.setRow(0,i,pn4[i]); // Display 4
  delay(1000); 
  for (int i = 0; i<8; i++) lc.setRow(0,i,pn3[i]); // Display 3
  delay(1000);
  
  }

And the problem is. . . ?
(You didn't post all your code?)

Point of terminology. :grin:

Please note there is no such thing as a "void loop()". There is a function which is called "loop()". As a matter of definition it returns no parameter when called so it is first defined as " void". But you always refer to it as " loop()". :face_with_raised_eyebrow:

1 Like

image

Calm . . . :wink:

Geez, my software looks like that!
:crazy_face:

1 Like

Looking in othr forums I found this solution

After the last delay(1000) I added the text below and the loop stoed

delay(1000);
  // Exit the loop 
exit(0);  //The 0 is required to prevent compile error.
    
  }

It is not a 'solution", it's wrong.

Why do you want "to close a loop"? What for?

If you want that your code is run only once - move it to setup().

Alternatively, use for(;;); or while(1); at the end of loop(). Or use a flag (variable) for stuff that you only want to run once.

good idea So I would just leave it under setup ?

That is teh idea.

Something you want to only ever do once, you put in setup().

Things you want to continue to do, go in loop().

It is rather unusual that you want to use a microcontroller to do one thing and no more.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.