Arduino Forum

Using Arduino => Programming Questions => Topic started by: randomnoob2 on Mar 22, 2019, 11:30 pm

Title: Issues with moving a servo
Post by: randomnoob2 on Mar 22, 2019, 11:30 pm
I am trying to make a servo turn 180 degrees, and it compiles but there is an issue with uploading which I assume is attributed to the addition of the motor controller:

Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 2152 bytes (6%) of program storage space. Maximum is 32256 bytes.
Global variables use 50 bytes (2%) of dynamic memory, leaving 1998 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't set com-state for "\\.\COM3"
An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Is this a noob error or what? I put on my motor controller and plugged the servo onto the correspoding pins, and it did a quick little turn but just for a second. I followed a little tutorial and from what I know I put the right wires into the right spot on the arduino without the motor controller, but I'm not sure. Here is my code:

#include <Servo.h>
int servoPin=3;
Servo Servo1;
void setup(){
Servo1.attach(servoPin);
}
void loop(){
Servo1.write(0);
delay(2000);
Servo1.write(45);
delay(1000);
Servo1.write(90);
delay(1000);
Servo1.write(180);
delay(1000);
}

Any help for a noob is welcome.
Title: Re: Issues with moving a servo
Post by: UKHeliBob on Mar 22, 2019, 11:53 pm
Code: [Select]
avrdude: ser_open(): can't set com-state for "\\.\COM3"Which port have you got selected in the Tools/Port menu in the IDE ?
Title: Re: Issues with moving a servo
Post by: pert on Mar 23, 2019, 03:44 am
Is this the same motor shield you posted about causing this problem back in 2016?
http://forum.arduino.cc/index.php?topic=434865 (http://forum.arduino.cc/index.php?topic=434865)