DigitalRead problems

So I tried to make a code in which a LED does things depending on how long you hold a button. After testing it I discovered that my Arduino doesn't detect changes in the button state. digitalRead(button) just outputs constant 1. I tried testing the pin in another sketch and the read function worked normally so the code must be wrong. Please help me!!!

Please post your code here.

PieterP:
Please post your code here.

Or post your question in the rubbish bin, too.

How is the button wired? My bet, it's between the pin and Vcc...

This is a problem: " while (digitalRead(button == LOW))"

int button = 4;
int ledPin = 5;


int state;
long startTime;
long currentTime;
long holdTime;
int brightness;
int fadeAmount = 10;


void setup()
{
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(button, INPUT_PULLUP);
  pinMode(ledPin, OUTPUT);
}


void loop()
{
  // put your main code here, to run repeatedly:
  state = digitalRead(button);
  if (digitalRead(button) == LOW)
  {
    startTime = millis();
    while (digitalRead(button == LOW))
    {
      currentTime = millis();
      holdTime = currentTime - startTime;
    }
  }
  if (holdTime > 1000 && holdTime < 3000)
  {
    analogWrite(ledPin, brightness);
    brightness = brightness + fadeAmount;
    if (brightness <= 0 || brightness >= 255)
    {
      fadeAmount = -fadeAmount;
    }


    delay(30);
  }
  if (holdTime < 500)
  {
    digitalWrite(ledPin, HIGH);
  }


  if (holdTime > 3000)
  {
    digitalWrite(ledPin, LOW);
  }
  Serial.println(state);
  delay(10);
}

septillion:
How is the button wired? My bet, it's between the pin and Vcc...

I use two wires as a button. One is connected to the pin and the other to ground.