I have a simple function to catch the edge of a button press and do something:
  bool SetLED(int Button,int LED, bool LED_State, bool Button_Pressed)
{
  //Get Button State
  bool LiveButtonPress = (digitalRead(Button) == LOW);
  if ( LiveButtonPress && not(Button_Pressed)) // Pos Edge of Button Press
    {
        LED_State = not(LED_State);
        if (LED_State)
        {
          digitalWrite(LED,HIGH);
        }else
        {
          digitalWrite(LED,LOW);
        }
        digitalWrite(LED_BUILTIN,HIGH);
    }
    else
    {
        digitalWrite(LED_BUILTIN,LOW);
    }
    
  Button_Pressed = LiveButtonPress;
  return false;
}
I want to be able to manipulate the variable I am passing to the function for both LED_State and ButtonPressed so I can reference that state elsewhere in pascal I would do this via a var in the function arguments, is there something similar in C++?
