My code doesn't work.

If you want to know if a pin is high or low you have to READ the pin. It's no good just comparing the NUMBER of the pin with HIGH. You'll find digitalRead() is useful for this purpose.

Steve