Go Down

Topic: How Do I Run Two Motors Same Time WIth Arduino Motor Shied R3 (Read 916 times) previous topic - next topic

adruinouno111

Mar 23, 2013, 01:22 am Last Edit: Mar 23, 2013, 02:45 am by adruinouno111 Reason: 1
How Do I Run Two Motors Same Time WIth Arduino Motor Shied R3? Can I See Code Please.
Adruino Mega

Thank You

JimboZA

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.
Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

adruinouno111

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

JimboZA


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  8)
Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

adruinouno111

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

adruinouno111

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

Using 9V Battery Motors Are Each 3V

baselsw


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: [Select]
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);
}

adruinouno111

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

Go Up