Debouncing 2 push buttons

In your original sketch, while(1) is entirely redundant. You have placed an endless loop inside another endless loop.

void loop() {
  while(1){
    ...
  }
}