Pages: [1]   Go Down
Author Topic: Arduino UNO+Motor Shield DC motor controlling !  (Read 2346 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 239
Posts: 24371
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Useful resource
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?

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);
 
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 239
Posts: 24371
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There's nothing wrong with the code (well, nothing syntactically wrong) - that's an upload error; did you select and connect the correct board?
« Last Edit: October 08, 2012, 06:43:06 am by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 549
Posts: 46125
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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)?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there any idea ?  smiley-confuse
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 549
Posts: 46125
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Pages: [1]   Go Up
Jump to: