Arduino - perform task only ONCE every second

So maybe I'll add a change interval method after all.

I was thinking along the lines of interval and duration both in the start line. Not to be able to change the interval on the fly so much as to take two static parameters in the first place. Something like this would be good:

  tm.startTimer(1000,500,toggleLED);  // interval,duration (aka off time / on time)

DavidOConnor:

The display is a colour screen with 320x240Resolution

Which display do you have? Which library are you using? Some TFT libraries have poor performance rendering fonts. However in some cases performance can be improved significantly.

Its a 2.4" ST7781R 8bit display with an adafruit library

The Adafruit libraries have poor font rendering performance. They use drawPixel to render a glyph instead of using the controller's windowing functions (which would be about 10x faster).

DavidOConnor: The Adafruit libraries have poor font rendering performance. They use drawPixel to render a glyph instead of using the controller's windowing functions (which would be about 10x faster).

Any particular one you recomend?

I am trying to set the library to do the print statments for me

I have

void loop (){
tm.runTimers();
  //****************PRINT*********************
void lcdprint(int timer) 
*** error here **** {

  tft.setCursor(60, 40);
  tft.setTextSize(6);
  tft.println(values[3],0);
  
   tft.setCursor(80, 270); tft.setTextSize(2);
  tft.setTextColor(WHITE, BLACK);
  tft.print(F("TRIP: "));
  tft.println(values[3]);
  tft.setCursor(80, 295); tft.setTextSize(1);
  tft.println(F("TOTAL: 57651"));
}
}

this gives me an error error: a function-definition is not allowed here before '{' token

void loop (){
tm.runTimers();
} // <<<<<<<<<<

Oh… I am calling myself idiot now :blush:

Ok... so I sorted the timers but not my problem.

So now after the LCD routine is done I read the serial data. 5 values using the text finder library.

Problem is when it starts reading (say 12345/CR) it often starts at a random number (345/CR12). How can I wait for the CR AND check if I received 5 fields before printing?

Regards