Arduino UNO+Motor Shield DC motor controlling !

Hello,

I have an Arduino UNO R3 and Motor Shield. I want to control a dc motor via motor shield.

I am new at programming.

Are there any control program example for me ? Thank you.

Useful resource

I found this code for using one DC motor but the motor did not work. I got this error : avrdude: stk500_getsync(): not in sync: resp=0x00

How can I fix this code ?

void setup() {
  
  //Setup Channel A
  pinMode(12, OUTPUT); //Initiates Motor Channel A pin
  pinMode(9, OUTPUT); //Initiates Brake Channel A pin
  
}

void loop(){
  
  //forward @ full speed
  digitalWrite(12, HIGH); //Establishes forward direction of Channel A
  digitalWrite(9, LOW);   //Disengage the Brake for Channel A
  analogWrite(3, 128);   //Spins the motor on Channel A at full speed
  
  delay(3000);
  
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A

  delay(1000);
  
  //backward @ half speed
  digitalWrite(12, LOW); //Establishes backward direction of Channel A
  digitalWrite(9, LOW);   //Disengage the Brake for Channel A
  analogWrite(3, 123);   //Spins the motor on Channel A at half speed
  
  delay(3000);
  
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A
  
  delay(1000);

There’s nothing wrong with the code (well, nothing syntactically wrong) - that’s an upload error; did you select and connect the correct board?

did you select and connect the correct board?

And, did you make sure that there is nothing connected to pins 0 and 1 (directly or via any shield)?

Yes, I selected the correct board (Arduino UNO R3).

PaulS:

did you select and connect the correct board?

And, did you make sure that there is nothing connected to pins 0 and 1 (directly or via any shield)?

There is nothing connected any pins on shield. Just USB and motor connections on shield (A+ A-) are connected

Is there any idea ? :~

Is there any idea ?

I have a couple. First, you might try telling us, via a link, just which shield you have.

Second, you might try removing the shield while uploading the sketch.