Variable not working with keyboard press.

If you are really interested, you need to learn how to use variables to control program flow:

The sketch offered to you was meant to stimulate your mind.

Try this:

// Version   YY/MM/DD
//  2.00     20/03/23   Running code

#include <Keyboard.h>

#define PUSHED             HIGH

#define LEDon              HIGH
#define LEDoff             LOW

const byte Harnesslight  = 4;
const byte HarnessButton = 3;
const byte heartBeatLED  = 13;

byte lastSwitchState;

byte counter;                   //0= first press, 1=second press

//timing stuff
unsigned long heartBeatMillis;
unsigned long switchMillis;


//******************************************************************************
void setup()
{
  pinMode(heartBeatLED, OUTPUT);
  pinMode(Harnesslight, OUTPUT);

  pinMode(HarnessButton, INPUT_PULLUP);

} //END of setup()

//******************************************************************************
void loop()
{
  //***************************
  //toggle Heartbeat LED every 500ms
  if (millis() - heartBeatMillis > 500)
  {
    //restart timer
    heartBeatMillis = millis();

    //toggle LED
    digitalWrite(heartBeatLED, !digitalRead(heartBeatLED));
  }

  //***************************
  //time to check the switches?
  if (millis() - switchMillis > 50)
  {
    //restart timer
    switchMillis = millis();

    checkSwitches();
  }


} //END of loop()

//******************************************************************************
void checkSwitches()
{
  byte switchState;

  //*******************************************
  switchState = digitalRead(HarnessButton);

  //***********************
  if (lastSwitchState != switchState)
  {
    //update to the new state
    lastSwitchState = switchState;

    //*********
    //was it pushed/closed
    if (switchState == PUSHED)
    {
      if (counter == 0)
      {
        counter++;

        Keyboard.press(0xC9);
        Keyboard.release(0xC9);

        digitalWrite(Harnesslight, LEDon);
      }

      else
      {
        counter = 0;

        Keyboard.press(0xCA);
        Keyboard.release(0xCA);

        digitalWrite(Harnesslight, LEDoff);
      }
    }
  }

} //END of checkSwitches()