Adding debounce for switch input

I personally never liked libraries for simple stuff.

here is a simple debounce routine that is easy to understand and is non-blocking.

const byte button = 5;
const byte ledPin = 13;
void setup() {
  pinMode (button,INPUT_PULLUP);
  pinMode(ledPin,OUTPUT);
}

void loop() {
  byte buttonState = buttonCheck();
  if (buttonState == 1) {
    digitalWrite (ledPin,HIGH);
    delay (250);     // hate delay but its just an example
  } else {
    digitalWrite (ledPin,LOW);
  }
}

byte buttonCheck()   // Returns a positive result Once per press
{
  static int isButtonPressed = 0;

  if (digitalRead(button) == LOW)   //  button reads LOW when Pressed
  {
    isButtonPressed++;              // Increment Debounce variable
  } else {
    isButtonPressed = 0;            // if it bounces reset
  }

  if (isButtonPressed == 10)    //number of consecutive positive reads to be accepted as a legitimate press 
  {                                                // Adjust as needed
    return 1;               // Confirmed button Press
  } else {
    return 0;               // button not pressed
  }
}