My code doesn't work.

Either save the value when you read it and use the saved value or read the value when you want to use it e.g.

LED1state = digitalRead(LED1);
if (LED1state == HIGH....
 or

if ((digitalRead(LED1) == HIGH)....

Either of those will work but doing the read and then ignoring the result doesn't work.

Steve