A rotary encoder with sound

#define NOTE_E4 330
 #define NOTE_G4 392
 #define NOTE_A4 440
 #define NOTE_B4 494
 int read_rotary(int CurrentState, int LastState);
 void setup (){
  Serial.begin(115200);

 pinMode(18, INPUT_PULLUP);
 pinMode(17, INPUT_PULLUP);
 pinMode(11, OUTPUT);
 pinMode(9, OUTPUT);
 pinMode(6, OUTPUT);
 pinMode(3, OUTPUT);
int CurrentSate, LastState;
LastState=read_rotary();
while(1){
CurrentState=read_rotary ();
    if((CurrentState==3)&&(LastState==1){ //moved to the right 2 times from 1-3//
      digitalWrite(11, HIGH);
      digitalWrite(9 LOW);
      digitalWrite(6, LOW);
      digitalWrite(3, LOW);
      tone( 5, NOTE_B4);
    }
    else if((CurrentState==3)&&(LastState==2){ //moved right 1 time from 2-3//
      digitalWrite(11, LOW);
      digitalWrite(9 HIGH);
      digitalWrite(6, LOW);
      digitalWrite(3, LOW);
      tone( 5, NOTE_A4);
    }
    else if((CurrentState==0)&&(LastState==2)){ //moved right 2 times 2-0 loop//
      digitalWrite(11, LOW);
      digitalWrite(9 LOW);
      digitalWrite(6, HIGH);
      digitalWrite(3, LOW);
      tone( 5, NOTE_E4);
    }
    else if((CurrentState==1)(LastState==0)){ //moved right 1 time from 0-1//
      digitalWrite(11, LOW);
      digitalWrite(9 LOW);
      digitalWrite(6, LOW);
      digitalWrite(3, HIGH);
      tone( 5, NOTE_G4);
    }
     if((CurrentState==1)&&(LastState==3){ //moved to the left 2 times from 3-1//
      digitalWrite(11, LOW);
      digitalWrite(9 LOW);
      digitalWrite(6, LOW);
      digitalWrite(3, HIGH);
      tone( 5, NOTE_G4);
    }
    else if((CurrentState==3)&&(LastState==2){ //moved left 1 time from 3-2 //
      digitalWrite(11, LOW);
      digitalWrite(9 LOW);
      digitalWrite(6, HIGH);
      digitalWrite(3, LOW);
      tone( 5, NOTE_E4);
    }
    else if((CurrentState==2)&&(LastState==0)){ //moved left 2 times 0-2 loop//
      digitalWrite(11, LOW);
      digitalWrite(9 HIGH);
      digitalWrite(6,LOW);
      digitalWrite(3, LOW);
      tone( 5, NOTE_A4);
    }
    else if((CurrentState==3)(LastState==2)){ //moved left 3 times from 2-3//
      digitalWrite(11, HIGH);
      digitalWrite(9 LOW);
      digitalWrite(6, LOW);
      digitalWrite(3, LOW);
      tone( 5, NOTE_B4);
    }
}
 }
void loop (){
}
int read_rotary(int CurrentState, int LastState){
   int counter=0;
   LastState = digitalRead(17); 
   CurrentState = digitalRead(18); 
   if (CurrentState != LastState){     
     if (digitalRead(17) != CurrentState) { 
       counter ++;
     } else {
       counter --;
     }
     Serial.print("POSTION: ");
     Serial.println(counter);
   } 
   LastState = CurrentState; // Updates the previous state of the outputA with the current state

}

}
}

So im stuck in this project.
Basically the code is used when i rotate the rotary bottom left and depending how far left or right sounds come out but the code wont upload ....Any suggestions?

Arduino uno 3, edushield

Why do you think a picture is helpful with an upload problem? What makes you think there is an upload problem? That would sure make helping easier.

Paul

I don't understand your question at all, but I'll jump to the upload problem.

Of course it won't upload- it won't even compile.
You have mismatched braces.
You have uninitialized variables.
Fix the compile errors.
Use CTRL-T to make the code more readable.

What is this even a picture of?

What does the posted picture represent?

The picture is the edushield connected to the arduino and to has both the rotary and speaker.
And brackets on the if statements?