detect voltage project

I’m using a arduino mega 2560, with a LCD. Right now the program i have displays four boxes with four different names. What i want to be able to do is if you select one of the names it can tell you if the person is considered online or offline. The status i want to set is if its receiving more then 5 volts its online less is offline. I have the wiring done on a breadboard to give 5 volts. Now i understand analogread in the code and write it by using if/else statements, but i’m new to programming so i’m not sure how to go about specifically how to write it. Any advice or suggestions would be appreciated, thank you. I included the code below.

#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>

// Declare which fonts we will be using
extern uint8_t SmallFont;
extern uint8_t BigFont;
extern uint8_t Dingbats1_XL;

// Set up UTFT…
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino 2009/Uno/Leonardo shield : ,19,18,17,16
// Standard Arduino Mega/Due shield : ,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28
// Standard chipKit Uno32/uC32 : ,34,35,36,37
// Standard chipKit Max32 : ,82,83,84,85
// AquaLEDSource All in One Super Screw Shield : ,82,83,84,85
//
// Remember to change the model parameter to suit your display module!
UTFT myGLCD(ITDB32S,38,39,40,41);

// Set up UTouch…
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino 2009/Uno/Leonardo shield : 15,10,14,9,8
// Standard Arduino Mega/Due shield : 6,5,4,3,2
// CTE TFT LCD/SD Shield for Arduino Due : 6,5,4,3,2
// Standard chipKit Uno32/uC32 : 20,21,22,23,24
// Standard chipKit Max32 : 62,63,64,65,66
// AquaLEDSource All in One Super Screw Shield : 62,63,64,65,66
UTouch myTouch(6,5,4,3,2);

// Finally we set up UTFT_Buttons :slight_smile:
UTFT_Buttons myButtons(&myGLCD, &myTouch);

int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor

void setup()
{
pinMode(ledPin, OUTPUT); // sets the pin as output
myGLCD.InitLCD();
myGLCD.clrScr();
myGLCD.setFont(SmallFont);

myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);

myButtons.setTextFont(BigFont);
myButtons.setSymbolFont(Dingbats1_XL);

}

void loop()
{
int but1, but2, but3, but4, butX, butY, pressed_button;
boolean default_colors = true;

but1 = myButtons.addButton( 10, 40, 100, 50, “Mark”);
but2 = myButtons.addButton( 10, 130, 100, 50, “Carl”);
but3 = myButtons.addButton( 190, 40, 100, 50, “Ricky”);
but4 = myButtons.addButton( 190, 130, 100, 50, “Sarah”);
butX = myButtons.addButton(279, 199, 40, 40, “Y”, BUTTON_SYMBOL);
butY = myButtons.addButton( 0, 199, 40, 40, “w”, BUTTON_SYMBOL /| BUTTON_SYMBOL_REP_3X/);
myButtons.drawButtons();

myGLCD.print(“STMS CONFERENCE CALL”, 80, 10);
myGLCD.setColor(VGA_WHITE);
myGLCD.setBackColor(VGA_BLACK);
myGLCD.print("None ", 110, 220);

while(1)
{
if (myTouch.dataAvailable() == true)
{
pressed_button = myButtons.checkButtons();

if (pressed_button==butX)
{
if (myButtons.buttonEnabled(but4))
myButtons.disableButton(but4, true);
else
myButtons.enableButton(but4, true);
}
else if (pressed_button==butY)
{
if (default_colors)
{
myButtons.setButtonColors(VGA_RED, VGA_RED, VGA_RED, VGA_BLUE, VGA_WHITE);
myButtons.relabelButton(butY, “w”);
myButtons.drawButtons();
default_colors=false;
}
else
{
myButtons.setButtonColors(VGA_WHITE, VGA_GRAY, VGA_WHITE, VGA_RED, VGA_BLUE);
myButtons.relabelButton(butY, “w”);
myButtons.drawButtons();
default_colors=true;
}
}
if (pressed_button==but1)
myGLCD.print(“MAX”, 110, 220);
if (pressed_button==but2)
myGLCD.print(“AHMAD”, 110, 220);
if (pressed_button==but3)
myGLCD.print(“STEVE”, 110, 220);
if (pressed_button==but4)
myGLCD.print(“JOHN”, 110, 220);
if (pressed_button==-1)
myGLCD.print("None ", 110, 220);
}
}
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
// turn the ledPin on
digitalWrite(ledPin, HIGH);
// stop the program for milliseconds:
delay(sensorValue);
// turn the ledPin off:
digitalWrite(ledPin, LOW);
// stop the program for for milliseconds:
delay(sensorValue);
}

start by putting your code inside [ code] [/ code]

(but without the spaces then we can read it properly)