How to rotate 3 servo motors when 6 led lights are lit using EMG signals
Apart the problem you have (that the constants are not defined), what you are asking can be easily solved by looking at the servo library.

The servo library tells you that


You have to include the servo library header: #include &lt;Servo.h&gt;
You have to add a variable to hold the object: Servo myservo;
You have to attach the object to a pin: myservo.attach(SERVO_PIN);
Finally you can move the motor to any position (0 &lt;= x &lt;= 180) with the syntax myservo.write(val);


In your code, then, you have the variable litLeds which tells you how many leds are there. Particularly if you have 6 (or more) leds light you will move to 90°, while with 0 (or less - even if this is meaningless) you reset to 0. So the complete code is

#include &lt;Servo.h&gt;

int finalReading;
byte litLeds = 0;
byte multiplier = 1;
byte leds[] = {8, 9, 10, 11, 12, 13};
Servo myservo;

void setup(){
    Serial.begin(9600); //begin serial communications
    for(int i = 0; i &lt; NUM_LED; i++){ //initialize LEDs as outputs
        pinMode(leds[i], OUTPUT);
    }
    myservo.attach(SERVO_PIN);
    myservo.write(0);
}

void loop(){
    for(int i = 0; i &lt; 10; i++){    //take ten readings in ~0.02 seconds
        reading[i] = analogRead(A0) * multiplier;
        delay(2);
    }
    for(int i = 0; i &lt; 10; i++){   //average the ten readings
        finalReading += reading[i];
    }
    finalReading /= 10;
    for(int j = 0; j &lt; NUM_LED; j++){  //write all LEDs low
        digitalWrite(leds[j], LOW);
    }
    Serial.print(finalReading);
    Serial.print("\t");
    finalReading = constrain(finalReading, 0, MAX);
    litLeds = map(finalReading, 0, MAX, 0, NUM_LED);
    Serial.println(litLeds);
    for(int k = 0; k &lt; litLeds; k++){
        digitalWrite(leds[k], HIGH);
    }
    if (litLeds &gt;= 6)
        myservo.write(90);
    else if (litLeds &lt;= 0)
        myservo.write(0);

    //for serial debugging, uncomment the next two lines.
    //Serial.println(finalReading);
    //delay(100);
}


Please note that some defines are missing (e.g. the MAX, NUM_LED and SERVO_PIN)