What type of Arduino?
How is your button wired? Have you used a pull-up or pull-down resistor?
Try this:
#define BTN 27
void setup() {
pinMode(BTN, INPUT);
Serial.begin(115200);
}
void loop() {
while (digitalRead(BTN) == LOW); //wait for button to be pressed
Serial.println("Pressed!");
delay(1000);
Serial.println("1 second has passed since the last button press!");
while (digitalRead(BTN) == HIGH); //if button is still pressed, wait for it to be released
}