motor code error

It does not do anything

What do you mean by that?
You are entering numbers in the serial monitor, aren't you?

( when posting code, please use code tags, and please don't SHOUT)

This

 if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

isn't really necessary; the Servo library does it for you - any value sent to the Servo write method greater than about 540 is automatically sent to the writeMicroseconds method.