Problem configuring 2 buttons for 2 different sequences

    // if the state has changed, increment the counter
    if (buttonState2 == LOW)
    {

How do you know that buttonState2 has changed ?