Please help upload this code in IDE get this error

Circuit diagram :

int A=3;

int B=5;

int C=9;

int D=10;

int Speed=100;

String Command;

void setup() {

  

pinMode(A,OUTPUT);

pinMode(B,OUTPUT);

pinMode(C,OUTPUT);

pinMode(D,OUTPUT);

Serial.begin(9600);

}



void loop() {

 



while (Serial.available()==0) {

  

}

Command=Serial.readString();

Serial.println(Command);

if (Command=="forward") {

 analogWrite(A,Speed);

analogWrite(B,LOW);

analogWrite(C,LOW);

analogWrite(D,Speed);

}

if (Command=="stop") {

 analogWrite(A,LOW);

analogWrite(B,LOW);

analogWrite(C,LOW);

analogWrite(D,LOW);

}

if (Command=="backward") {

 analogWrite(A,LOW);

analogWrite(B,Speed);

analogWrite(C,Speed);

digitalWrite(D,LOW);

}

if (Command=="right") {

 analogWrite(A,LOW);

analogWrite(B,LOW);

analogWrite(C,LOW);

analogWrite(D,Speed);

}

if (Command=="left") {

 analogWrite(A,Speed);

analogWrite(B,LOW);

analogWrite(C,LOW);

analogWrite(D,LOW);

}

} 

Error when Upload it :point_down:
Arduino: 1.8.19 (Windows 7), Board: "Arduino Uno"

Sketch uses 4156 bytes (12%) of program storage space. Maximum is 32256 bytes.
Global variables use 236 bytes (11%) of dynamic memory, leaving 1812 bytes for local variables. Maximum is 2048 bytes.
An error occurred while uploading the sketch

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xc1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xc1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xc1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xc1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xc1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xc1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xc1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xc1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xc1
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xc1

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

Welcome to the forum

As your topic does not relate directly to the installation or operation of the IDE it has been moved to the Programming Questions category of the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Which Arduino board are you using ?

Arduino Uno R3 CH340G ATmega328p

problem

Disconnect these wires and try your upload again.

(The CH340 and HC-05 can't both use the serial lines at the same time.)

1 Like

I will Try But can you tell me according Circuit diagram A B C D (3,5,9,10) port number is correct or not in code ?

Whether your code works or not is not relevant to your uploading issue.

okk

edit: deleted last due to Hallowed31 error. Disregard.

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