void loop()
{
if(digitalRead(buttonpin) == HIGH)
{
Serial.println("button pressed");
delay(2000);
}
else{
Serial.println("button not pressed");
delay(2000);
}
I would like to make code so that when the button is pressed it breaks the loop until the button is released and not have a series of "the button is pressed" or "the button is not pressed" on the monitor.