LCD displaying text with me pressing the button

So it says “HELLO WORLD” but then goes right to the "A is for Apple with the button being pressed. I have tried changing it to say when button state LOW but then nothing happens after “HELLO WORLD”. Thank you

#include <LiquidCrystal.h>

const int button1Pin= 13;

int button1State = 0;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
lcd.begin(16, 2);
lcd.print(“HELLO WORLD”);
delay(3000);
lcd.clear();
}

void loop()
{
button1State = digitalRead(button1Pin);

if(button1State == HIGH)
{
lcd.setCursor(0,0);
lcd.print(" A is for APPLE ");
delay(3000);
lcd.clear();
}

}

It is unclear what you expect the sketch to do or what your issue is.

So it says “HELLO WORLD” but then goes right to the "A is for Apple with the button being pressed.

That is what the code says to do. If the button is wired to Vcc and an input with a pulldown resistor.

I have tried changing it to say when button state LOW

So does the switch have a pulldown resistor to prevent the pin from floating (indeterminate state)?

Please read the sticky posts.

How is the button wired?