Error Message

This is my code:

#include<Servo.h>
float y = 0; //Angle Value
float m = 19.0774; // SLOPE
float INT = -3.8515; // y intercept
float val = 0; // value of POT
float set_ang = 0; //Desired Angle
float check_ang = 0; //Angle after it has been checked
float motor_spd = 0; //Motor starts at zero
float comp_res = 0; //Difference of Angles
Servo myservo;

void setup(){
Serial.begin(9600);
myservo.attach(9);
}

void COMPARE(void){
comp_res = set_ang - check_ang; //Difference between set angle and checked angle
if(comp_res < 0){ //Decision to step up or step down
STEP_DOWN(); //Call Step Down function if result is less than 0
} else {
STEP_UP(); //Call Step Up function if result is greater than 0
}
}

void STEP_UP(void){
motor_spd = motor_spd + 1; //Increase the speed of motor
myservo.write(motor_spd); //Changes the duty cycle of PWM
delay(100); //Delay for 1/10 seconds
CHECK_ANGLE(); //Call CHECK ANGLE
}

void STEP_DOWN(void){
motor_spd = motor_spd - 1; //Decrease the speed of the motor
myservo.write(motor_spd); //Write new Motor position
delay(100); //Delay for 1/10 seconds
CHECK_ANGLE(); //Call CHECK ANGLE
}

void CHECK_ANGLE(void){
val = analogRead(A0); //val is the value of POT
val = map(val, 41, 1015, 0, 5); //Voltage value MAPPED
y = (val * m) + INT; //Formula for New Angles
if (y < 0){
y = 0;
} else {
check_ang = y; // check angle is equal to angle value in y
}
//Serial.print(y);
//Serial.println();
delay(100);
COMPARE(); //Adding this compare won’t let me write again
}
///////////////////////////CODE STARTS HERE////////////////////////////////
void loop(){
if (Serial.available() > 0){
set_ang = Serial.parseInt(); //Angle desired by user
Serial.println(set_ang);
COMPARE(); //Will change my PWM signal
}
//COMPARE(); //Will not let me type anything
}

and this is the error message I get:

Global variables use 281 bytes (13%) of dynamic memory, leaving 1,767 bytes for local variables. Maximum is 2,048 bytes.
avrdude: ser_open(): can’t set com-state for “\.\COM8”

Can some one explain please. Thanks

Can some one explain please.

What is there to explain? You have COM8 selected in the Tools + Port menu, when your Arduino clearly isn't connected to COM8.

I have changed ports, and reconnected the Arduino board. But nothing still happens. Thanks

I have changed ports, and reconnected the Arduino board. But nothing still happens.

What is this supposed to mean?

Unplug the Arduino. Start the IDE. Use the Tools + Port menu option to get a list of COM ports. Close the IDE. Plug the Arduino in. Start the IDE. Use the Tools + Port menu option to get a list of COM ports.

The port that is in the second list that is not in the first list is the one that the Arduino is connected to.