Infinite loop code

Hello Arduino Community,
I want to have an infinite loop for the strings so they repeat forever.
I need your help to continue with my project!
thanks.

You have not given enough detail to enable help to be given

I assume that you realise that the loop() function repeats forever

Post the code that you are having trouble with and explain what you want to do

Some popular infinite loops are:

void loop()
{
  // This repeats forever
}
  for (;;)
  {
    //This repeats forever
  }
  while (true)
  {
    //This repeats forever
  }
# define EVER (;;)
..
...
...
for EVER {

}

My favourite infinite loop

void loop()
{
    //code goes here
}

Im following a library tutorial from heltec cause I’m using an esp8266 oled board.
I want to infinite loop the following lines

// Some test data
const char* test = {
“XD”,
“;D” ,
“----”,
“:)”,
“(..)",
“8)”,
"(*
*)”,
“(^_^)”,
“:o”,
“:&”,
“(.+.)”

};

Here is the full code I have been programming.
THANKS FOR YOUR HELP GUYS!

#include “Arduino.h”
#include “heltec.h”

// Adapted from Adafruit_SSD1306
void drawLines() {
for (int16_t i = 0; i < DISPLAY_WIDTH; i += 4) {
Heltec.display->drawLine(0, 0, i, DISPLAY_HEIGHT - 1);
Heltec.display->display();
delay(10);
}
for (int16_t i = 0; i < DISPLAY_HEIGHT; i += 4) {
Heltec.display->drawLine(0, 0, DISPLAY_WIDTH - 1, i);
Heltec.display->display();
delay(10);
}
delay(250);

Heltec.display->clear();
for (int16_t i = 0; i < DISPLAY_WIDTH; i += 4) {
Heltec.display->drawLine(0, DISPLAY_HEIGHT - 1, i, 0);
Heltec.display->display();
delay(10);
}
for (int16_t i = DISPLAY_HEIGHT - 1; i >= 0; i -= 4) {
Heltec.display->drawLine(0, DISPLAY_HEIGHT - 1, DISPLAY_WIDTH - 1, i);
Heltec.display->display();
delay(10);
}
delay(250);

Heltec.display->clear();
for (int16_t i = DISPLAY_WIDTH - 1; i >= 0; i -= 4) {
Heltec.display->drawLine(DISPLAY_WIDTH - 1, DISPLAY_HEIGHT - 1, i, 0);
Heltec.display->display();
delay(10);
}
for (int16_t i = DISPLAY_HEIGHT - 1; i >= 0; i -= 4) {
Heltec.display->drawLine(DISPLAY_WIDTH - 1, DISPLAY_HEIGHT - 1, 0, i);
Heltec.display->display();
delay(10);
}
delay(250);
Heltec.display->clear();
for (int16_t i = 0; i < DISPLAY_HEIGHT; i += 4) {
Heltec.display->drawLine(DISPLAY_WIDTH - 1, 0, 0, i);
Heltec.display->display();
delay(10);
}
for (int16_t i = 0; i < DISPLAY_WIDTH; i += 4) {
Heltec.display->drawLine(DISPLAY_WIDTH - 1, 0, i, DISPLAY_HEIGHT - 1);
Heltec.display->display();
delay(10);
}
delay(250);
}

// Adapted from Adafruit_SSD1306
void drawRect(void) {
for (int16_t i = 0; i < DISPLAY_HEIGHT / 2; i += 2) {
Heltec.display->drawRect(i, i, DISPLAY_WIDTH - 2 * i, DISPLAY_HEIGHT - 2 * i);
Heltec.display->display();
delay(10);
}
}

// Adapted from Adafruit_SSD1306
void fillRect(void) {
uint8_t color = 1;
for (int16_t i = 0; i < DISPLAY_HEIGHT / 2; i += 3) {
Heltec.display->setColor((color % 2 == 0) ? BLACK : WHITE); // alternate colors
Heltec.display->fillRect(i, i, DISPLAY_WIDTH - i * 2, DISPLAY_HEIGHT - i * 2);
Heltec.display->display();
delay(10);
color++;
}
// Reset back to WHITE
Heltec.display->setColor(WHITE);
}

// Adapted from Adafruit_SSD1306
void drawCircle(void) {
for (int16_t i = 0; i < DISPLAY_HEIGHT; i += 2) {
Heltec.display->drawCircle(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, i);
Heltec.display->display();
delay(10);
}
delay(1000);
Heltec.display->clear();

// This will draw the part of the circel in quadrant 1
// Quadrants are numberd like this:
// 0010 | 0001
// ------|-----
// 0100 | 1000
//
Heltec.display->drawCircleQuads(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 4, 0b00000001);
Heltec.display->display();
delay(200);
Heltec.display->drawCircleQuads(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 4, 0b00000011);
Heltec.display->display();
delay(200);
Heltec.display->drawCircleQuads(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 4, 0b00000111);
Heltec.display->display();
delay(200);
Heltec.display->drawCircleQuads(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 4, 0b00001111);
Heltec.display->display();
}

void printBuffer(void) {
// Initialize the log buffer
// allocate memory to store 8 lines of text and 30 chars per line.
Heltec.display->setLogBuffer(2, 30);

// Some test data
const char* test = {
“XD”,
“;D” ,
“----”,
“:)”,
“(..)",
“8)”,
"(*
*)”,
“(^_^)”,
“:o”,
“:&”,
“(.+.)”

};

for (uint8_t i = 0; i < 11; i++) {
Heltec.display->clear();
// Print to the screen
Heltec.display->println(test*);*

  • // Draw it to the internal screen buffer*
  • Heltec.display->drawLogBuffer(0, 0);*
  • // Display it on the screen*
  • Heltec.display->display();*
  • delay(500);*
  • }*
    }
    void setup() {
    _ Heltec.begin(true /DisplayEnable Enable/, true /Serial Enable/);_
  • Heltec.display->setContrast(255);*
  • drawLines();*
  • delay(1000);*
  • Heltec.display->clear();*
  • drawRect();*
  • delay(1000);*
  • Heltec.display->clear();*
  • fillRect();*
  • delay(1000);*
  • Heltec.display->clear();*
  • drawCircle();*
  • delay(1000);*
  • Heltec.display->clear();*
  • printBuffer();*
  • delay(1000);*
  • Heltec.display->clear();*
    }
    void loop() { }

I want to infinite loop the following lines

You want to repeatedly print several smileys ?

More likely you did not Read this before posting a programming question where it advises the use of code tags to avoid the forum software interpreting some character combinations incorrectly. Please revise your post and put code tags around the code

Yes I want to repeat smileys.
I want to repeat the following lines

 const char* test[] = {
    "XD",
    ";D" ,
    "----",
    ":)",
    "(._.)",
    "8)",
    "(*_*)",
    "(^_^)",
    ":o",
    ":&",
    "(.+.)"
  
  };
#include "Arduino.h"
#include "heltec.h"


// Adapted from Adafruit_SSD1306
void drawLines() {
  for (int16_t i = 0; i < DISPLAY_WIDTH; i += 4) {
    Heltec.display->drawLine(0, 0, i, DISPLAY_HEIGHT - 1);
    Heltec.display->display();
    delay(10);
  }
  for (int16_t i = 0; i < DISPLAY_HEIGHT; i += 4) {
    Heltec.display->drawLine(0, 0, DISPLAY_WIDTH - 1, i);
    Heltec.display->display();
    delay(10);
  }
  delay(250);

  Heltec.display->clear();
  for (int16_t i = 0; i < DISPLAY_WIDTH; i += 4) {
    Heltec.display->drawLine(0, DISPLAY_HEIGHT - 1, i, 0);
    Heltec.display->display();
    delay(10);
  }
  for (int16_t i = DISPLAY_HEIGHT - 1; i >= 0; i -= 4) {
    Heltec.display->drawLine(0, DISPLAY_HEIGHT - 1, DISPLAY_WIDTH - 1, i);
    Heltec.display->display();
    delay(10);
  }
  delay(250);

  Heltec.display->clear();
  for (int16_t i = DISPLAY_WIDTH - 1; i >= 0; i -= 4) {
    Heltec.display->drawLine(DISPLAY_WIDTH - 1, DISPLAY_HEIGHT - 1, i, 0);
    Heltec.display->display();
    delay(10);
  }
  for (int16_t i = DISPLAY_HEIGHT - 1; i >= 0; i -= 4) {
    Heltec.display->drawLine(DISPLAY_WIDTH - 1, DISPLAY_HEIGHT - 1, 0, i);
    Heltec.display->display();
    delay(10);
  }
  delay(250);
  Heltec.display->clear();
  for (int16_t i = 0; i < DISPLAY_HEIGHT; i += 4) {
    Heltec.display->drawLine(DISPLAY_WIDTH - 1, 0, 0, i);
    Heltec.display->display();
    delay(10);
  }
  for (int16_t i = 0; i < DISPLAY_WIDTH; i += 4) {
    Heltec.display->drawLine(DISPLAY_WIDTH - 1, 0, i, DISPLAY_HEIGHT - 1);
    Heltec.display->display();
    delay(10);
  }
  delay(250);
}

// Adapted from Adafruit_SSD1306
void drawRect(void) {
  for (int16_t i = 0; i < DISPLAY_HEIGHT / 2; i += 2) {
    Heltec.display->drawRect(i, i, DISPLAY_WIDTH - 2 * i, DISPLAY_HEIGHT - 2 * i);
    Heltec.display->display();
    delay(10);
  }
}

// Adapted from Adafruit_SSD1306
void fillRect(void) {
  uint8_t color = 1;
  for (int16_t i = 0; i < DISPLAY_HEIGHT / 2; i += 3) {
    Heltec.display->setColor((color % 2 == 0) ? BLACK : WHITE); // alternate colors
    Heltec.display->fillRect(i, i, DISPLAY_WIDTH - i * 2, DISPLAY_HEIGHT - i * 2);
    Heltec.display->display();
    delay(10);
    color++;
  }
  // Reset back to WHITE
  Heltec.display->setColor(WHITE);
}

// Adapted from Adafruit_SSD1306
void drawCircle(void) {
  for (int16_t i = 0; i < DISPLAY_HEIGHT; i += 2) {
    Heltec.display->drawCircle(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, i);
    Heltec.display->display();
    delay(10);
  }
  delay(1000);
  Heltec.display->clear();

  // This will draw the part of the circel in quadrant 1
  // Quadrants are numberd like this:
  //   0010 | 0001
  //  ------|-----
  //   0100 | 1000
  //
  Heltec.display->drawCircleQuads(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 4, 0b00000001);
  Heltec.display->display();
  delay(200);
  Heltec.display->drawCircleQuads(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 4, 0b00000011);
  Heltec.display->display();
  delay(200);
  Heltec.display->drawCircleQuads(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 4, 0b00000111);
  Heltec.display->display();
  delay(200);
  Heltec.display->drawCircleQuads(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 4, 0b00001111);
  Heltec.display->display();
}

void printBuffer(void) {
  // Initialize the log buffer
  // allocate memory to store 8 lines of text and 30 chars per line.
  Heltec.display->setLogBuffer(2, 30);

 
  const char* test[] = {
    "XD",
    ";D" ,
    "----",
    ":)",
    "(._.)",
    "8)",
    "(*_*)",
    "(^_^)",
    ":o",
    ":&",
    "(.+.)"
  
  };

  for (uint8_t i = 0; i < 11; i++) {
    Heltec.display->clear();
    // Print to the screen
    Heltec.display->println(test[i]);
    // Draw it to the internal screen buffer
    Heltec.display->drawLogBuffer(0, 0);
    // Display it on the screen
    Heltec.display->display();
    delay(500);
  }
}

void setup() {
  Heltec.begin(true /*DisplayEnable Enable*/, true /*Serial Enable*/);

  Heltec.display->setContrast(255);

  drawLines();
  delay(1000);
  Heltec.display->clear();

  drawRect();
  delay(1000);
  Heltec.display->clear();

  fillRect();
  delay(1000);
  Heltec.display->clear();

  drawCircle();
  delay(1000);
  Heltec.display->clear();

  printBuffer();
  delay(1000);
  Heltec.display->clear();
}

void loop() { }

Just call “printBuffer” in loop()?

What went wrong when you tried that?