Hi! please help me. I'm new here and I don't know what seems to be the problem as it always says " avrdude: ser_open(): can't open device "\.\COM7": The system cannot find the file specified.Problem uploading to board. See https://support.arduino.cc/hc/en-us/sections/360003198300 for suggestions." when ever I compile my code. I simply want it to make my motor (micro servo 9g) move/ change angle. I also don't think there is something wrong with my code.
this is the code that I used to test it:
#include <Servo.h>
Servo myservo;
int pos = 0;
void setup() {
myservo.attach(9);
}
void loop () {
myservo.write(0);
delay(500);
myservo.write(80);
delay(500);
}
and here's one that I got online(also tried to upload it onto my board):
#include <Servo.h>
/* After including the corresponding libraries,
we can use the "class" like "Servo" created by the developer for us.
We can use the functions and variables created in the libraries by creating
objects like the following "myservo" to refer to the members in ".".*/
Servo myservo;
//it created an object called myservo.
/* you can see Servo as a complex date type(Including functions and various data types)
and see myservo as variables. */
void setup(){
/*"attach" and "write" are both functions,
and they are members contained in the complex structure of "Servo".
We can only use them if we create the object "myservo" for the complex structure of "Servo".
*/
myservo.attach(9);//connect pin 9 with the control line(the orange line of Servo)
myservo.write(90);// move servos to center position -> 90°
}
void loop(){
//myservo.write(90);// move servos to center position -> 90°
//delay(50);
myservo.write(0);// move servos to center position -> 60°
delay(500);
myservo.write(3);// move servos to center position -> 90°
delay(500);
//myservo.write(150);// move servos to center position -> 120°
//delay(500);
}
and I still get the same message at the end. I've also tried refreshing my board, uninstalling my IDE, updating my board, updating the libraries, and installing the servo library and yet I still get the same message over and over again and I still don't know what to do.
I hope you can help me. Thank you