user7556: I need debouncing/stateChange for a push button configuration. Is there a good library for debouncing/stateChange buttons in Arduino (without delay)?  

user1612: I can receommend the following library:
http://log.liminastudio.com/itp/physical-computing/arduino-a-new-improved-button-library-with-some-handy-features
https://github.com/virgildisgr4ce/Button
On the website you will find some examples on how to use it. I have implemented this library already in several sketches and it works very reliably.

user6740: You can put a capacitor in parallel with the switch - 100nf should do the trick. Some capacitors have a minus on the packaging, next to one of the pins - if so, make sure that side is to negative (ground).

user37274: I put this together for a guy the other day. Its not a library but it achieves reading and debouncing all of your buttons and works very well maybe it could help you
const byte numbuttons = 15;                                                     // DEFINE HOW MAY DIGITAL INPUTS TO MONITOR(NUMBER OF BELOW PINS TO USE)
const byte digitalpin[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16 };   // DECLARE ALL DIGITAL INPUT PINS WHICH CAN BE USED IN THE ORDER IN WHICH THEY WILL BE PHYSICALLY USED(DONT INCLUDE ANY PINS USED FOR OTHER THINGS
const byte debouncetime = 50;                                                   // THIS VALUE IS THE TIME TO WAIT BEFORE RECHECKING (FOR DEBOUNCE
byte readstate[numbuttons];                                                     // READ ARRAY
byte laststate[numbuttons];                                                     // HOLDS THE BUTTON LAST STATE FOR STATE CHANGE DETECTION
byte NumBut;                                                                     // THIS IS THE VARIABLE FOR DIGITAL FORLOOP COUNTER
unsigned long checktime;                                            // RECORDS THE TIMES (IN MILLIS() TO RECHECK THE STATE FOR EACH BUTTON. FOR DEBOUCING

byte CURRENT_SETTING;
void setup() {

  // SET INITIAL STATES FOR DIGITALS
  for (NumBut = 0; NumBut < numbuttons; NumBut++) {
    pinMode(digitalpin[NumBut], INPUT_PULLUP);
    laststate[NumBut] = digitalRead (digitalpin[NumBut]);
    checktime = 0;
  }
}

void loop() {
  //call the read button method
  READBUTTONS();
  PROGRAM_OUTPUT();
}

void READBUTTONS() {
  for (NumBut = 0; NumBut < numbuttons; NumBut++) {

    readstate[NumBut] = (digitalRead (digitalpin[NumBut]));                                                                   // READ DIGITAL INPUTS INTO ARRAY

    if (readstate[NumBut] != laststate[NumBut] && millis() >= checktime )   {
      if (readstate[NumBut] == 0 && laststate[NumBut] == 1) {
        checktime = millis() + debouncetime;
        CURRENT_SETTING = NumBut;
      }
      laststate[NumBut] = readstate[NumBut];
    }
  }
}

void PROGRAM_OUTPUT(){
    switch ( CURRENT_SETTING ) {
    case 0:   //do something to turn off output break;
    case 1:   //do something with setting 1 break;
    case 2:   //do something with setting 2 break;
    case 3:   //do something with setting 3 break;
    default:    break;
}
}


user49085: You can use my library
https://github.com/anlgncr/Buttons
This library lets you use buttons as many as you wish with only one instance of class.
You can also call a function when button is pushed or released.

user66103: I'm on this subject right now and I'll use this to note my findings.
I found many libs on this, and this is my wishlist:

support many buttons
support toggles or switches
support debouncing and maybe de-glitching
non-blocking functions
support long-press, double-click

Candidates:

Switch from avandalen: tutorial - github - lib ref@arduino - @platformio
EasyButton from Evert Arias: tutorial - github - lib ref@arduino - @platformio
JCButton from JChristensen: github - lib ref@arduino - @platformio
ezButton from ArduinoGetStarted: tutorial - github - lib ref@arduino - @platformio

Here are my findings for each lib:
Switch

it's really easy to use
you can use it as a switch or a button, same class handles both
supports callbacks
supports many buttons
supports debouncing and de-glitching
supports double click and long press
most configs have defaults, and you define them at the Button setup
as I use PlatformIO, some warnings from this lib are shown while compiling my project

EasyButton

it's really easy to use
very good docs
supports callbacks
supports many buttons
does not support toggles/switches, although you can simulate it by checking the wasPressed and wasReleased properties
supports debouncing
supports double click, triple click, or a given number of clicks
you may have a different action for single, double or triple click for the same button
supports multiple times of long press, if needed
most configs have defaults, and you define them at the Button setup

JC Button

easy to use, not as easy as Switch and EasyButton tough
you can use it as a Button or a switch (ToggleButton), different class for each
supports many buttons
does not support callbacks
supports debouncing
supports multiple times of long press, if needed
most configs have defaults, and you may define them at the Button setup, but long press time is something you define while querying it's status rather than defining it once at the button setup

ezButton

easy to use, not as easy as Switch and EasyButton tough
supports many buttons
does not support toggles/switches, although you can simulate it by checking the isPressed and isReleased events
does not support long press
does not support callbacks
supports debouncing, does not debounce by default (you must call setDebounceTime on setup)
supports an easy way to count button clicks

Veredict
I chose avdweb/Switch. Reasons:

in terms of debouncing AND de-glitching, it did better according to my tests
I need a solution for Buttons and Switches, and it provides them in the same class


user7282: I think what you need is an interrupt-based detection of the button. This way, your Arduino can do what it needs to do without stalling for the delay function. 
// Example code usage

int pin = 13; // LED on board
int interrupt0pin = 2; // pin attached to int0 if you're using Uno
int buttonState;

void setup()
{
  pinMode(pin, OUTPUT);
  pinMode(interrupt0pin, INPUT);
  attachInterrupt(0, buttonUpdate, CHANGE); // calls buttonUpdate() when button input changes (you can also use high-to-low or low-to-high)
}

void loop()
{
    if (buttonState)
        digitalWrite(pin, HIGH);
    else
        digitalWrite(pin, LOW);
}

void buttonUpdate()
{
  buttonState = digitalRead(interrupt0pin);
  delay(50); // 50ms works for most switches - adjustable
}

Find out more here: http://arduino.cc/en/Reference/AttachInterrupt
Good luck!

user7938: The Button library in the Arduino playground works perfectly.

7556: <p>I need debouncing/stateChange for a push button configuration. Is there a good library for debouncing/stateChange buttons in Arduino (without delay)?  </p>
 1612: <p>I can receommend the following library:</p>

<p><a href="http://log.liminastudio.com/itp/physical-computing/arduino-a-new-improved-button-library-with-some-handy-features" rel="nofollow">http://log.liminastudio.com/itp/physical-computing/arduino-a-new-improved-button-library-with-some-handy-features</a>
<a href="https://github.com/virgildisgr4ce/Button" rel="nofollow">https://github.com/virgildisgr4ce/Button</a></p>

<p>On the website you will find some examples on how to use it. I have implemented this library already in several sketches and it works very reliably.</p>
 6740: <p>You can put a capacitor in parallel with the switch - 100nf should do the trick. Some capacitors have a minus on the packaging, next to one of the pins - if so, make sure that side is to negative (ground).</p>
 37274: <p>I put this together for a guy the other day. Its not a library but it achieves reading and debouncing all of your buttons and works very well maybe it could help you</p>

<pre><code>const byte numbuttons = 15;                                                     // DEFINE HOW MAY DIGITAL INPUTS TO MONITOR(NUMBER OF BELOW PINS TO USE)
const byte digitalpin[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16 };   // DECLARE ALL DIGITAL INPUT PINS WHICH CAN BE USED IN THE ORDER IN WHICH THEY WILL BE PHYSICALLY USED(DONT INCLUDE ANY PINS USED FOR OTHER THINGS
const byte debouncetime = 50;                                                   // THIS VALUE IS THE TIME TO WAIT BEFORE RECHECKING (FOR DEBOUNCE
byte readstate[numbuttons];                                                     // READ ARRAY
byte laststate[numbuttons];                                                     // HOLDS THE BUTTON LAST STATE FOR STATE CHANGE DETECTION
byte NumBut;                                                                     // THIS IS THE VARIABLE FOR DIGITAL FORLOOP COUNTER
unsigned long checktime;                                            // RECORDS THE TIMES (IN MILLIS() TO RECHECK THE STATE FOR EACH BUTTON. FOR DEBOUCING

byte CURRENT_SETTING;
void setup() {

  // SET INITIAL STATES FOR DIGITALS
  for (NumBut = 0; NumBut &lt; numbuttons; NumBut++) {
    pinMode(digitalpin[NumBut], INPUT_PULLUP);
    laststate[NumBut] = digitalRead (digitalpin[NumBut]);
    checktime = 0;
  }
}

void loop() {
  //call the read button method
  READBUTTONS();
  PROGRAM_OUTPUT();
}

void READBUTTONS() {
  for (NumBut = 0; NumBut &lt; numbuttons; NumBut++) {

    readstate[NumBut] = (digitalRead (digitalpin[NumBut]));                                                                   // READ DIGITAL INPUTS INTO ARRAY

    if (readstate[NumBut] != laststate[NumBut] &amp;&amp; millis() &gt;= checktime )   {
      if (readstate[NumBut] == 0 &amp;&amp; laststate[NumBut] == 1) {
        checktime = millis() + debouncetime;
        CURRENT_SETTING = NumBut;
      }
      laststate[NumBut] = readstate[NumBut];
    }
  }
}

void PROGRAM_OUTPUT(){
    switch ( CURRENT_SETTING ) {
    case 0:   //do something to turn off output break;
    case 1:   //do something with setting 1 break;
    case 2:   //do something with setting 2 break;
    case 3:   //do something with setting 3 break;
    default:    break;
}
}
</code></pre>
 49085: <p>You can use my library</p>

<p><a href="https://github.com/anlgncr/Buttons" rel="nofollow noreferrer">https://github.com/anlgncr/Buttons</a></p>

<p>This library lets you use buttons as many as you wish with only one instance of class.</p>

<p>You can also call a function when button is pushed or released.</p>
 66103: <p>I'm on this subject right now and I'll use this to note my findings.</p>
<p>I found many libs on this, and this is my wishlist:</p>
<ul>
<li>support many buttons</li>
<li>support toggles or switches</li>
<li>support debouncing and maybe de-glitching</li>
<li>non-blocking functions</li>
<li>support long-press, double-click</li>
</ul>
<p>Candidates:</p>
<ul>
<li>Switch from avandalen: <a href="https://www.avdweb.nl/arduino/hardware-interfacing/simple-switch-debouncer" rel="nofollow noreferrer">tutorial</a> - <a href="https://github.com/avandalen/avdweb_Switch" rel="nofollow noreferrer">github</a> - <a href="https://www.arduino.cc/reference/en/libraries/switch/" rel="nofollow noreferrer">lib ref@arduino</a> - <a href="https://platformio.org/lib/show/2117/Switch" rel="nofollow noreferrer">@platformio</a></li>
<li>EasyButton from Evert Arias: <a href="https://easybtn.earias.me/docs/fundamentals/" rel="nofollow noreferrer">tutorial</a> - <a href="https://github.com/evert-arias/EasyButton" rel="nofollow noreferrer">github</a> - <a href="https://www.arduino.cc/reference/en/libraries/easybutton/" rel="nofollow noreferrer">lib ref@arduino</a> - <a href="https://platformio.org/lib/show/5741/EasyButton" rel="nofollow noreferrer">@platformio</a></li>
<li>JCButton from JChristensen: <a href="https://github.com/JChristensen/JC_Button" rel="nofollow noreferrer">github</a> - <a href="https://www.arduino.cc/reference/en/libraries/jc_button/" rel="nofollow noreferrer">lib ref@arduino</a> - <a href="https://platformio.org/lib/show/77/JC_Button" rel="nofollow noreferrer">@platformio</a></li>
<li>ezButton from ArduinoGetStarted: <a href="https://arduinogetstarted.com/tutorials/arduino-button-library" rel="nofollow noreferrer">tutorial</a> - <a href="https://github.com/ArduinoGetStarted/button" rel="nofollow noreferrer">github</a> - <a href="https://www.arduino.cc/reference/en/libraries/ezbutton/" rel="nofollow noreferrer">lib ref@arduino</a> - <a href="https://platformio.org/lib/show/8336/ezButton" rel="nofollow noreferrer">@platformio</a></li>
</ul>
<p>Here are my findings for each lib:</p>
<h3><strong>Switch</strong></h3>
<ul>
<li>it's really easy to use</li>
<li>you can use it as a switch or a button, same class handles both</li>
<li>supports callbacks</li>
<li>supports many buttons</li>
<li>supports debouncing and de-glitching</li>
<li>supports double click and long press</li>
<li>most configs have defaults, and you define them at the Button setup</li>
<li>as I use PlatformIO, some warnings from this lib are shown while compiling my project</li>
</ul>
<h3><strong>EasyButton</strong></h3>
<ul>
<li>it's really easy to use</li>
<li>very good docs</li>
<li>supports callbacks</li>
<li>supports many buttons</li>
<li>does not support toggles/switches, although you can simulate it by checking the <code>wasPressed</code> and <code>wasReleased</code> properties</li>
<li>supports debouncing</li>
<li>supports double click, triple click, or a given number of clicks</li>
<li>you may have a different action for single, double or triple click for the same button</li>
<li>supports multiple times of long press, if needed</li>
<li>most configs have defaults, and you define them at the Button setup</li>
</ul>
<h3><strong>JC Button</strong></h3>
<ul>
<li>easy to use, not as easy as Switch and EasyButton tough</li>
<li>you can use it as a <code>Button</code> or a switch (<code>ToggleButton</code>), different class for each</li>
<li>supports many buttons</li>
<li>does not support callbacks</li>
<li>supports debouncing</li>
<li>supports multiple times of long press, if needed</li>
<li>most configs have defaults, and you may define them at the Button setup, but long press time is something you define while querying it's status rather than defining it once at the button setup</li>
</ul>
<h3><strong>ezButton</strong></h3>
<ul>
<li>easy to use, not as easy as Switch and EasyButton tough</li>
<li>supports many buttons</li>
<li>does not support toggles/switches, although you can simulate it by checking the <code>isPressed</code> and <code>isReleased</code> events</li>
<li>does not support long press</li>
<li>does not support callbacks</li>
<li>supports debouncing, does not debounce by default (you must call <code>setDebounceTime</code> on setup)</li>
<li>supports an easy way to count button clicks</li>
</ul>
<h3>Veredict</h3>
<p>I chose avdweb/Switch. Reasons:</p>
<ul>
<li>in terms of debouncing AND de-glitching, it did better according to my tests</li>
<li>I need a solution for Buttons and Switches, and it provides them in the same class</li>
</ul>
 7282: <p>I think what you need is an interrupt-based detection of the button. This way, your Arduino can do what it needs to do without stalling for the delay function. </p>

<pre><code>// Example code usage

int pin = 13; // LED on board
int interrupt0pin = 2; // pin attached to int0 if you're using Uno
int buttonState;

void setup()
{
  pinMode(pin, OUTPUT);
  pinMode(interrupt0pin, INPUT);
  attachInterrupt(0, buttonUpdate, CHANGE); // calls buttonUpdate() when button input changes (you can also use high-to-low or low-to-high)
}

void loop()
{
    if (buttonState)
        digitalWrite(pin, HIGH);
    else
        digitalWrite(pin, LOW);
}

void buttonUpdate()
{
  buttonState = digitalRead(interrupt0pin);
  delay(50); // 50ms works for most switches - adjustable
}
</code></pre>

<p>Find out more here: <a href="http://arduino.cc/en/Reference/AttachInterrupt" rel="noreferrer">http://arduino.cc/en/Reference/AttachInterrupt</a></p>

<p>Good luck!</p>
 7938: <p>The <a href="http://playground.arduino.cc/code/Button" rel="noreferrer">Button library</a> in the Arduino playground works perfectly.</p>
