Help with programming a tester!



//********************************************************************************
//Version    YY/MM/DD    Description
//1.00       21/09/29    Running sketch
//
//

#define CLOSED                       LOW
#define OPENED                       HIGH

#define PRESSED                      LOW
#define RELEASED                     HIGH

#define ENABLED                      true
#define DISABLED                     false

#define relayON                      LOW
#define relayOFF                     HIGH

//***************************************************************

const byte heartbeatLED            = 13;
const byte passLED                 = 12;
const byte failLED                 = 11;
const byte relayPin                = 8;
const byte runSwitch               = 4;
const byte resetSwitch             = 3;

byte lastRunSwitchState            = OPENED;

//timing stuff
unsigned long heartbeatMillis;
unsigned long switchMillis;


//***************************************************************
void setup()
{
  Serial.begin(9600);

  pinMode(heartbeatLED, OUTPUT);
  pinMode(passLED, OUTPUT);
  pinMode(failLED, OUTPUT);

  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, relayOFF);

  pinMode(runSwitch, INPUT_PULLUP);
  pinMode(resetSwitch, INPUT_PULLUP);

} //END of setup()


//***************************************************************
void loop()
{
  //*************************************                          h e a r t b e a t   T I M E R
  //to see if the sketch is blocking,
  //toggle the heartbeat LED every 500ms
  if (millis() - heartbeatMillis >= 500)
  {
    //restart the TIMER
    heartbeatMillis = millis();

    //toggle the LED
    digitalWrite(heartbeatLED, !digitalRead(heartbeatLED));
  }

  //*************************************                          c h e c k S w i t c h   T I M E R
  //is it time to read the switches ?
  if (millis() - switchMillis >= 50)
  {
    //restart the TIMER
    switchMillis = millis();

    checkSwitches();
  }

  //*************************************

} //END of loop()


//********************************************************************************
void checkSwitches()
{
  //*********************************************                    r u n S w i t c h
  //runSwitch code
  byte currentState = digitalRead(runSwitch);

  //**********************
  //was there a change in state ?
  if (lastRunSwitchState != currentState)
  {
    //update to the new state
    lastRunSwitchState = currentState;

    //**********************                                         C L O S E D
    //is the switch closed ?
    if (currentState == CLOSED)
    {
      //do something ?
    }

    //**********************                                         O P E N E D
    //the switch is opened
    else
    {
      //do something ?
    }

  } //END of runSwitch code


  //*********************************************                    o t h e r S w i t c h e s
  //next switch code
  //*********************************************

} //END of   checkSwitches()


//********************************************************************************