Problem with Input

In the following sketch, Arduino uno doesn' t read the button, in fact, regardless of the state of the input, the condition is still false.

int LED = 13;
int BUTTON = 2;

void setup() {
pinMode(BUTTON, INPUT);
pinMode(LED, OUTPUT);

}

void loop() {

if(BUTTON == HIGH){
digitalWrite(LED, HIGH);
delay(50);
digitalWrite(LED, LOW);
delay(50);
}
else{
(BUTTON == LOW);
digitalWrite(LED, LOW);
delay(1000);
digitalWrite(LED, HIGH);
delay(1000);
}
}

That's because you haven't asked it to read the button. The variable BUTTON is a pin number and it is equal to 2. Expecting it to change or comparing it to LOW or HIGH doesn't make much sense.

You're using some digitalWrite() commands. Now it's time to have a look at digitalRead().

Steve

You made the variable "BUTTON" equal to 2.

It's always 2.

when you say:
if(BUTTON == HIGH){

you are just saying
if(2 == HIGH){

you are NOT saying 'if pin 2 == HIGH'

And you don't need this: (BUTTON == LOW); even though it's missing parts anyway.