Push Button with actuators

I am occurring with a problem with, what I am doing wrong?


`<void setup()
{
Serial.begin(9600);
pinMode(9,OUTPUT );
pinMode(LEDpin,INPUT_PULLUP); // set the pushbutton pin as input with internal pull-up resistor }
}

void loop(){
int x = analogRead(A0);
int y = map(x, 0, 1023, 0, 255);
analogWrite(9, y);
state = digitalRead(LEDpin);
if(state == LOW){ // button is pressed digitalWrite(9, HIGH); } else{ // button is not pressed digitalWrite(9, LOW); } }
state=digitalRead(LEDpin);
}
}/>`