INPUT_PULLUP as its name implies pulls the input HIGH when the button is not pressed.
So
if (digitalRead(2) == HIGH) will be true until you press the button. Try if (digitalRead(2) == LOW) instead
INPUT_PULLUP as its name implies pulls the input HIGH when the button is not pressed.
So
if (digitalRead(2) == HIGH) will be true until you press the button. Try if (digitalRead(2) == LOW) instead