Need help getting a program to loop

I reckon a simple solution is to change the name of the existing function that is called loop() to showMessage() and create a new function called loop() with this content

void loop() {
  if (millis() - prevShowMillis >= showInterval) {
     prevShowMillis += showInterval;
     received = millis();
     showMessage();
  }
}

and at the top of the code you will also need to define the variables

unsigned long prevShowMillis;
unsigned long showInterval = 5000; // show every 5 secs

...R