Pages: [1]   Go Down
Author Topic: How Do I Run Two Motors Same Time WIth Arduino Motor Shied R3  (Read 805 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How Do I Run Two Motors Same Time WIth Arduino Motor Shied R3? Can I See Code Please.
Adruino Mega

Thank You
« Last Edit: March 22, 2013, 08:45:13 pm by adruinouno111 » Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 82
Posts: 3863
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's explained here...

You just need to set pins 12 and 13 for motor A and B direction, and PWM pins 3 and 11 for their speed.
Logged

The Elders of the Internet know who I am.....

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can You Provide Me With Sample Code I Tried It But Only One Motor Works.
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 82
Posts: 3863
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can You Provide Me With Sample Code I Tried It But Only One Motor Works.

Why don't you rather post your code so far and perhaps a pic of the circuitry....  then we can help you get it fixed, rather than do it for you  smiley-cool
Logged

The Elders of the Internet know who I am.....

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

int E1 = 3;
int M1 = 12;
int E2 = 11;                     
int M2 = 13;                       
 
void setup()
{
    pinMode(M1, OUTPUT); 
    pinMode(M2, OUTPUT);
}
 
void loop()
{
    digitalWrite(M1,LOW);
    digitalWrite(M2, LOW);
    digitalWrite(E2, HIGH);
    digitalWrite(E1, HIGH);   
    delay(5000);
 }
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It lights up both A and B lights but all i hear is humming?

Using 9V Battery Motors Are Each 3V
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 13
Posts: 257
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

int E1 = 3;
int M1 = 12;
int E2 = 11;                     
int M2 = 13;                       
 
void setup()
{
    pinMode(M1, OUTPUT); 
    pinMode(M2, OUTPUT);
}
 
void loop()
{
    digitalWrite(M1,LOW);
    digitalWrite(M2, LOW);
    digitalWrite(E2, HIGH);
    digitalWrite(E1, HIGH);   
    delay(5000);
 }


Please use the code quotes next time... Anyway I can directly see that you didn't define the pins of E1 and E2 as outputs.. Try this to begin with:

Code:
int E1 = 3;
int M1 = 12;
int E2 = 11;                     
int M2 = 13;                       
 
void setup()
{
    pinMode(E1, OUTPUT); 
    pinMode(E2, OUTPUT); 
    pinMode(M1, OUTPUT); 
    pinMode(M2, OUTPUT);
}
 
void loop()
{
    digitalWrite(M1,LOW);
    digitalWrite(M2, LOW);
    digitalWrite(E2, HIGH);
    digitalWrite(E1, HIGH);   
    delay(5000);
 }
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

[SOLVED] I Had To Get A 4 AA Battery Pack For The Motor Shield.
Logged

Pages: [1]   Go Up
Jump to: