LED's with switch not working

so i just got my arduino like two days ago and i am trying to make a two LED's switch were if is no current going to pin 4 and LED will be flashing but if it is high anouther led turns on instead and does not flash. i typed up the could and it gives me no errors but when i plug it all in nothing happens :blush:

here is my code

void setup() {
  pinMode(12, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(4, INPUT);
  pinMode(7, OUTPUT);

int brightness = 0;
int fadeAmount = 5;

void loop ()

  digitalWrite(7, HIGH);
  if( 4 == HIGH)
     analogWrite(9, brightness);    

     brightness = brightness + fadeAmount;

     if (brightness == 0 || brightness == 255) {
        fadeAmount = -fadeAmount ; 
    if(4 == LOW)
       digitalWrite(12, HIGH);

You have to digitalRead your pin 4.

Place your int declarations before the void setup ()

Also, you might want to look into the current state of the LED's and change them if required.

For example, Pin 12 is made HIGH if Pin 4 is LOW but it will then stay HIGH forever although I suspect the intention is that it will go LOW if if Pin 4 subsequently changes to HIGH.

And you do have a resistor in seriese with each LED don't you.

thanks a lot and yes i have resistors with the LEDS

if( 4 == HIGH)

This doesn't seem likely.