Go Down

Topic: Problem uploading to board.  (Read 190 times) previous topic - next topic

Nathalia2613

i dont know whats wrong with my arduino is not compiling my code no matter what i have restarted my laptop 3 times already disconnected my wire mouse coz i thought that mb coz i have others equipments connected to my laptop and still the same ERROR  i just bought another arduino UNO  coz i really dont know whats going on and same thing with the other one ;-;

this is the error

Code: [Select]
Arduino: 1.8.10 (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 5550 bytes (17%) of program storage space. Maximum is 32256 bytes.
Global variables use 252 bytes (12%) of dynamic memory, leaving 1796 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\\.\COM3": The system cannot find the file specified.


Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

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



and this is my code which doesnt present any error to the moment to verify it
Code: [Select]
#include <Servo.h>

Servo servo1; 
Servo servo2;
Servo servo3;
char a;
String readString;
int Forwardmotor = 8;     //pins in the arduino UNO
int Backwardmotor = 9;
int speed = 255;   //(motor speed  0-255)

void setup() {
  servo1.attach(5);
  servo2.attach(6);
  servo3.attach(7);
  servo1.write(0);   //initial servos position
  servo2.write(0);  // initial servos position
  servo3.write(90); //initial servos position
  pinMode(Forwardmotor, OUTPUT);
  pinMode(Backwardmotor, OUTPUT);
 
  Serial.begin(9600);
  delay(10);
}

void loop() {
 if (Serial.available()) { 
    a = Serial.read();
   
    if(a=='A'){       
      motor1();
    }
   
    if(a=='B'){                           
      motor2();
    }
     if(a=='F'){       
      motor3();
    }
   
    if(a=='C'){       //motor move forward                       
       analogWrite(Forwardmotor, speed);
       analogWrite(Backwardmotor, 0);
    }
   
    if(a=='D'){      //motor move backward                   
       analogWrite(Forwardmotor, 0);
       analogWrite(Backwardmotor, speed);
    }

    if(a=='E'){     //motor stop                       
       analogWrite(Forwardmotor, 0);
       analogWrite(Backwardmotor,0);     
    }
  }


 
void motor1(){ //servo motor 1   //servo motor get slider thumbsposition
        delay(10);   
        while (Serial.available()) {
                           
          char c = Serial.read(); 
          readString += c;       
        }
        if (readString.length() >0) {   
          Serial.println(readString.toInt()); 
          servo1.write(readString.toInt());
          readString=""; // Clear string
        }
}

void motor2(){   //servo motor 2    //servo motor get slider thumbsposition
        delay(10);
        while (Serial.available()) {                 
          char c = Serial.read(); 
          readString += c;         
        }
        if (readString.length() >0) {
          Serial.println(readString.toInt()); 
          servo2.write(readString.toInt());
          readString="";
        }
}

void motor3(){   //servo motor 3    //servo motor get slider thumbsposition
        delay(10);
        while (Serial.available()) {                 
          char c = Serial.read(); 
          readString += c;         
        }
        if (readString.length() >0) {
          Serial.println(readString.toInt()); 
          servo3.write(readString.toInt());
          readString="";
        }
}

void motor12 (){ //servo motor 1 and 2
  delay(10);
        while (Serial.available()) {                 
          char c = Serial.read(); 
          readString += c;         
        }
        if (readString.length() >0) {
          Serial.println(readString.toInt()); 
          servo1.write(readString.toInt());
          readString="";
          servo2.write(readString.toInt());
          readString="";
        }
}
   

ballscrewbob

#1
Dec 21, 2019, 04:51 pm Last Edit: Dec 21, 2019, 05:06 pm by ballscrewbob
COMMON ISSUES
  • Ensure you have FULLY inserted the USB cables.
  • Check you have a COMMON GROUND where required. ( Thanks Perry)
  • Where possible use USB 2.0 ports or a USB 2.0 POWERED HUB to rule out USB 3.0 issues.
  • Try other computers where possible.
  • Try other USB leads where possible.
  • You may not have the correct driver installed. CH340/341 or CP2102
  • There may be a problem with the board check your wiring first.
  • Remove any items connected to pins 0 and 1.


Bob.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

sterretje

I would start by checking what Windows Device Manager says when you connect the board. Is it still COM3?
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

skywatch

@Nathalia A few things to try....

Before uploading the file to the arduino check that the 'correct' com port is selected as another device may be using a com port without you knowing.

If you still have issues, try removing 1.8.10 and installing 1.8.9 instead. I had problems with 1.8.10 and roling back to 1.8.9 cured them all!

Good Luck!

Go Up