Telemtry System Printing to LCD Help

Hello,
I am creating a pretty basic telemetry system for an electric car however I have come across some problems when I want to print it to the LCD screen for the driver to see.

I can get all of the telemetry system to print to the serial, SD card and screen (The data being printed all at once)

However for the screen I want to locate the data being printed on different sections on the screen, for example the screen is cleared and different data is displayed when a button is pressed which I cannot get to work. I have tried using code found on the internet with no success so I copied my code into the 'HelloWorld' example code but when a button is pressed the message is displayed for only the time it is pressed (I have been doing some research and have come to a conclusion that I have to set it either to high or low but not exactly sure how?)

As the race for the car is an hour long I will need to delay how often data is saved and displayed.
For example the temperature which I am measuring will not changed fast so the refresh rate will need to be 10 seconds whereas I will need regular amp draw readings at every 2 seconds.
How would I get it so that there is a delay of 10 seconds to display the temperature reading and save it to the SD card and only a delay of 2 seconds for amp draw.

Attached is the code for the current version of the telemetry system. (If it can be optimised please suggest any improvements or apply code to solve the problems above would be very much appreciated!)
Thank you.

#include <Wire.h>
#include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>
#include <SD.h>
#include <SPI.h>

Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

// These #defines make it easy to set the backlight color
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7

File myFile;
int sensorPin = 0;
int val = 0;

//Voltage
int VRaw; //This will store our raw ADC data
int IRaw;
float VFinal; //This will store the converted data
float IFinal;

void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
Serial.begin(9600);
lcd.print("Initializing...");
Serial.println("Initializing SD Card...");
if (!SD.begin(10))
{Serial.println("Initialization Failed!");
return;
}
delay(1500);
lcd.clear();
Serial.println("Initialization Complete!");
lcd.print("Initialized!");
lcd.setBacklight(WHITE);
delay(2000);
lcd.clear();
}

uint8_t i=0;
void loop() {

myFile = SD.open("data.csv", FILE_WRITE);

if (myFile)
{
int reading = analogRead(sensorPin);
float voltage = reading * 5.0;
voltage /= 1024.0;
float temperatureC = (voltage - 0.5) * 100 ;

//Measurement
VRaw = analogRead(A1);
IRaw = analogRead(A5);

//Conversion
//VFinal = VRaw/49.44; //45 Amp board
//VFinal = VRaw/12.99; //90 Amp board
VFinal = VRaw/12.99; //180 Amp board

//IFinal = IRaw/14.9; //45 Amp board
//IFinal = IRaw/7.4; //90 Amp board
IFinal = IRaw/3.7; //180 Amp board

Serial.print(temperatureC);
Serial.println(" Degrees Celsius");
Serial.print(VFinal);
Serial.println(" Volts");
Serial.print(IFinal);
Serial.println(" Amps");
Serial.println(millis());

myFile.print(temperatureC);
myFile.print(", ");
myFile.print(VFinal);
myFile.print(", ");
myFile.print(IFinal);
myFile.print(", ");
myFile.println(millis());
myFile.close();

lcd.setCursor(0, 0);
lcd.print("T:");
lcd.print(temperatureC);
lcd.setCursor(0, 1);
lcd.print("V:");
lcd.print(VFinal);
lcd.print(" A:");
lcd.print(IFinal);

}
else
{
Serial.println("Error in opening file");
lcd.clear();
lcd.print("SD Card Error");
void setup();
delay(5000);
}

uint8_t buttons = lcd.readButtons();

if (buttons) {
lcd.clear();
lcd.setCursor(0,0);
if (buttons & BUTTON_UP) {
lcd.print("UP ");
lcd.setBacklight(RED);
}
if (buttons & BUTTON_DOWN) {
lcd.print("DOWN ");
lcd.setBacklight(YELLOW);
}
if (buttons & BUTTON_LEFT) {
lcd.print("LEFT ");
lcd.setBacklight(GREEN);
}
if (buttons & BUTTON_RIGHT) {
lcd.print("RIGHT ");
lcd.setBacklight(TEAL);
}
if (buttons & BUTTON_SELECT) {
lcd.print("SELECT ");
lcd.setBacklight(VIOLET);
}
}
}

LCD_Telemtry_System.ino (2.73 KB)

have been doing some research and have come to a conclusion that I have to set it either to high or low but not exactly sure how?

It? What is "it" that you think you need to set to HIGH or LOW?Why do you think that you can set the state of an input device?

How would I get it so that there is a delay of 10 seconds to display the temperature reading and save it to the SD card and only a delay of 2 seconds for amp draw.

Look at the blink with delay example. Instead of blinking an LED, you will take a reading and write it to the card, or not. You will open the file and record some data, or not.

If it can be optimised please suggest any improvements

Variables should have the smallest possible scope. There is no reason for i, val , VRaw, IRaw, VFinal, or IFinal to be global.

It? What is "it" that you think you need to set to HIGH or LOW? Why do you think that you can set the state of an input device?

When looking around people using the liquid crystal set of commands used something along the lines: 'When(Certain button pressed) set high' or they gave each button an integer, when a button is pressed it would store that number and would correspond to the predefined numbers and therefore change the screen contents relating to that button.

When using those commands it did not seem to work with the Adafruit LCD with it not turning on. (Even though it stated it is a derivative)

Thank you will take a look at that example for the delay replacement and carry out those amendments.