error msg.

I have a wearied problem. I connected a motor to the L293 IC and it seemed to work ok at first, then I tried to download a change of direction while the motor was running and got this error msg.
avrdude:ser_open(): can’t set com-state for ” \.\com3
I found out that if I tried to change the direction while the motor was running I got this msg. but if I stalled the motor or the motor was not running and I changed the direction I did not get the msg. and the change downloaded ok.
I think it is caused by the counter emf produced by the motor while it is running.
Question is how do I keep this from happening??

What Arduino board are you using?

Are you trying to upload a revised program while the Serial Monitor is still using the serial connection?

It would be a big help if you post your Arduino program.


using the uno R3 board and serial monitor is not running at the time i try to download the direction change.

                 // IC = L293D
                 // IC pin 4 to Gnd.
                 // IC pin 8 to +5volts
                 //Motor red lead to IC pin-3
                 //motor black lead to IC pin-6
int speedpin=5;  //arduino pin 5 to IC pin-1: Yellow
int dir1=4;      //   "    pin 4 to IC pin-2: White
int dir2=3;      //   "    pin 3 to IC pin-7: Red
int mspeed=255;

void setup() {
  // put your setup code here, to run once:
pinMode (speedpin,OUTPUT);
pinMode (dir1,OUTPUT);
pinMode (dir2,OUTPUT);
Serial.begin (9600);

void loop() {
  // put your main code here, to run repeatedly:


I don’t use Windows myself. Have you checked to see if the Arduino is on a different COM port?


How is the motor powered? If it is powered by the Arduino it could be pulling the Arduino Vcc (supply voltage) down enough to affect the operation of the processor.

I am using the UNO R3 board the motor is powered with the power supply module that comes with the ELEGOO starter kit.
The wireing is as stated in the top of the sketch, the only other wire not listed in the sketch is the Ground of the UNO board is connected to the Ground of the power supply module.
The voltage at the motor when running is 4.17 volts and the motor resistance measures 10 ohms. I’m not sure what the coil resistance should be.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.