Led and button just not working.

I’ve just started with Arduino and am trying to do a super simple project to get started, but I just can’t get it to work >:( . I’ve gone past so many forum posts and tutorials, but none of the solutions work for me. I have a simple code and a simple setup, please look if you can see what im doing wrong:

Picture: Imgur: The magic of the Internet

int button=2;
void setup() {
  pinMode(13, OUTPUT);
  pinMode(button, INPUT_PULLUP);
  }

void loop() {
  if(button==0){
  digitalWrite(13, HIGH);  
}else {
    digitalWrite(13, LOW);   
}
}

button is the pin number 2 and it will never equal 0. Try digitalRead(button) instead.

Steve

To gain more experience, suggest you slow down and review the examples that come with the IDE.

Use CTRL T to format your code.

In the future:
Show us a good schematic of your circuit.
Show us a good image of your wiring.
Give links to components.
Posting images:

Use CTRL T to format the sketch.

slipstick:
button is the pin number 2 and it will never equal 0. Try digitalRead(button) instead.

Steve

Thanks so much, after alot of troubleshooting and with help of you it finally works, turns out I wired the button wrong

turns out I wired the button wrong

Tip.
Always wire those four pin push buttons across the diagonal then it does not matter which orientation it is in.