user52466: I am looking for a way to increment a variable by one each time a button is pressed. Current approach is the following :
    if (redButton.isPressed())
    {
        a++;
        delay(100);
    }

isPressed() just return true if the pin state is HIGH.
delay(100) is used to compensate the small amount of time the button is being pressed. Otherwise a would be incremented multiple times in a single press. But it's blocking behavior, my program can't do anything else during that delay.
In short I'm looking to add a method in my Button class to detect if the button "has just been released". 

user38721: In your approach a button press will be detected every 100ms when you just keep the button pressed. So you have to set a flag when the button is pressed. When the button is not pressed while your flag is set, that's the event you're looking for. In this way you can detect both a button press and a release respectively.
As @JRobert mentioned, there still has to be an amount of time between two calls to such a routine to provide some button debouncing.
bool pressed_flag=false;
bool button_timestamp=millis();
uint16_t button_period=100;

if(millis()-button_timestamp>button_period){
  button_timestamp=millis();
  if(redButton.isPressed() && !pressed_flag){
    // button has just been pressed
    // you can do sth. here
    pressed_flag=true;
  }
  else if(!redButton.isPressed() && pressed_flag){
    // button has just been released
    // you can do sth. here
    pressed_flag=false;
  }
}


52466: <p>I am looking for a way to increment a variable by one each time a button is pressed. Current approach is the following :</p>

<pre><code>    if (redButton.isPressed())
    {
        a++;
        delay(100);
    }
</code></pre>

<p><code>isPressed()</code> just return true if the pin state is HIGH.</p>

<p><code>delay(100)</code> is used to compensate the small amount of time the button is being pressed. Otherwise <code>a</code> would be incremented multiple times in a single press. But it's blocking behavior, my program can't do anything else during that delay.</p>

<p>In short I'm looking to add a method in my Button class to detect if the button "has just been released". </p>
 38721: <p>In your approach a button press will be detected every 100ms when you just keep the button pressed. So you have to set a flag when the button is pressed. When the button is <strong>not</strong> pressed while your flag is set, that's the event you're looking for. In this way you can detect both a button press and a release respectively.
As @JRobert mentioned, there still has to be an amount of time between two calls to such a routine to provide some button debouncing.</p>

<pre><code>bool pressed_flag=false;
bool button_timestamp=millis();
uint16_t button_period=100;

if(millis()-button_timestamp&gt;button_period){
  button_timestamp=millis();
  if(redButton.isPressed() &amp;&amp; !pressed_flag){
    // button has just been pressed
    // you can do sth. here
    pressed_flag=true;
  }
  else if(!redButton.isPressed() &amp;&amp; pressed_flag){
    // button has just been released
    // you can do sth. here
    pressed_flag=false;
  }
}
</code></pre>
